You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ch...@t-systems.com on 2013/10/21 15:44:47 UTC

set session-timeout

Hello,

in my application i have set the errorpage for expired pages like this:

getApplicationSettings().setPageExpiredErrorPage(Timeout.class);

Now I want to make the time until the application expires configurable. How can I do this? Can I set this in the WicketApplication.init()?


Mit freundlichen Grüßen
Christoph Manig
Systems Engineer

T-Systems International GmbH
Systems Integration - SC Travel, Transport & Logistics
Hoyerswerdaer Str. 18
01099 Dresden
tel.:   +49 (0) 351 / 8152 - 188
fax:    +49 (0) 351 / 8152 - 209
email:  Christoph.Manig@t-systems.com




Re: AW: set session-timeout

Posted by Paul Borș <pa...@bors.ws>.
Right, you would have to do it on the Log In page during authentication as Martijn suggested.

We have a global Settings page where we let admins configure this duration in minutes and we enable it via our Log In page.

To do it for unauthorized users it won't really make sense. Why would you let them waste your servers resources and keep your servers busy longer than the web.xml descriptor already is configured for? What would be such a real use-case?

Have a great day,
    Paul Bors

> On Oct 23, 2013, at 5:41 AM, Martin Grigorov <mg...@apache.org> wrote:
> 
> On Wed, Oct 23, 2013 at 12:35 PM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
> 
>> AFAIK you can specify the session timeout in your web.xml or in your
>> container. I don't see why Wicket should get involved in that, other
>> than change the session timeout for logged in users (i.e. after they
>> successfully authenticated with your application), or special users
>> (administrators with limited session time, etc). In those cases you
>> already have a bound session, and you can use the previous call. If
>> you want to specify session timeout for all users, then do it in your
>> deployment descriptor.
> 
> Christoph's first message says: Now I want to make the time until the
> application expires *configurable*
> 
> 
>> 
>> http://stackoverflow.com/questions/15382895/session-timeout-in-web-xml
>> 
>> Martijn
>> 
>> On Wed, Oct 23, 2013 at 7:23 AM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>> On Wed, Oct 23, 2013 at 2:36 AM, Joachim Schrod <js...@acm.org> wrote:
>>> 
>>>>> On 10/22/13 15:32, Martin Grigorov wrote:
>>>>> On Tue, Oct 22, 2013 at 4:27 PM, Joachim Schrod <js...@acm.org>
>> wrote:
>>>>> 
>>>>>>> On 10/22/13 10:34, Christoph.Manig@t-systems.com wrote:
>>>>>>> If I do this in my WicketApplication class, in the init()
>>>>>>> method I get java.lang.reflect.UndeclaredThrowableException.
>>>>>>> But if I add this to my base page it works. Is there any
>>>>>>> possibility to do this in the WicketApplication class?
>>>>>> 
>>>>>> You have to redefine WebApplication#newSession().
>>>>>> 
>>>>>> It can't be done in init(), as no session exists yet. And you must
>>>>>> set the Session timeout for each new session anew.
>>>>>> 
>>>>>> Without having tried it, code like
>>>>>> 
>>>>>>    @Override
>>>>>>    public Session newSession(Request request, Response response) {
>>>>>>        Session session = super.newSession(request, response);
>> ((ServletWebRequest)request).getContainerRequest().getSession().setMaxInactiveInterval(TIMEOUT);
>>>>> 
>>>>> ALARM!
>>>>> getSession() is the same as getSession(true). I.e. it will create a
>> new
>>>>> http session for each and every http request, even for static
>> resources.
>>>>> 
>>>>> Wicket creates Wicket Session when Session.get() is used, but creates
>>>> Http
>>>>> Session only when wicketSession.bind() is called.
>>>> 
>>>> Interesting to hear; I'd have thought that works. Tricky thing,
>>>> that. As I wrote, I didn't try the code; I just copied the access
>>>> to HttpSession from the posts below.
>>>> 
>>>> But, since wicketSession.bind() is final, one cannot subclass
>>>> Session and redefine it either, to set the timeout there. (Much too
>>>> many methods of Wicket classes are final, without really good
>>>> reason; I copy them to my applications making the methods non-final
>>>> much too often. :-( )
>>> 
>>> If you override bind() and do something wrong then the functionality will
>>> break completely.
>>> 
>>> 
>>>> 
>>>> Martin, what would you propose to be the hook that allows to
>>>> establish a different session timeout application-wide within your
>>>> Java application? I hadn't had yet that case, web.xml suffices by
>>>> now, but it would be good to know for the future.
>>> 
>>> It is much better from framework point of view to give you a hook:
>> org.apache.wicket.session.ISessionStore#getBindListeners().add(myListener)
>>> 
>>> 
>>>> 
>>>> Cheers,
>>>>        Joachim
>>>> 
>>>>>>        return session;
>>>>>>    }
>>>>>> 
>>>>>> should work. Maybe check that request is really a
>>>>>> ServletWebRequest. (This is also a good place to set the locale.)
>>>>>> 
>>>>>> HTH,
>>>>>>        Joachim
>>>>>> 
>>>>>>> 
>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>> Von: francois meillet [mailto:francois.meillet@gmail.com]
>>>>>>> Gesendet: Montag, 21. Oktober 2013 16:34
>>>>>>> An: users@wicket.apache.org
>>>>>>> Betreff: Re: set session-timeout
>>>>>>> 
>>>>>>> HttpSession httpSession = ((ServletWebRequest)
>>>>>> RequestCycle.get().getRequest()).getContainerRequest().getSession();
>>>>>>> httpSession.setMaxInactiveInterval(timeOut);
>>>>>>> 
>>>>>>> François
>>>>>>> 
>>>>>>> 
>>>>>>> On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <
>>>> mgrigorov@apache.org
>>>>>>> wrote:
>>>>>>> 
>>>> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/a
>>>>>>>> pi/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com>
>>>> wrote:
>>>>>>>> 
>>>>>>>>> Hello,
>>>>>>>>> 
>>>>>>>>> in my application i have set the errorpage for expired pages
>> like
>>>>>> this:
>>>>>>>>> 
>>>>>>>>> getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
>>>>>>>>> 
>>>>>>>>> Now I want to make the time until the application expires
>>>>>> configurable.
>>>>>>>>> How can I do this? Can I set this in the
>> WicketApplication.init()?
>>>> --
>>>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>>> Joachim Schrod, Roedermark, Germany
>>>> Email: jschrod@acm.org
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AW: set session-timeout

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Oct 23, 2013 at 12:35 PM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> AFAIK you can specify the session timeout in your web.xml or in your
> container. I don't see why Wicket should get involved in that, other
> than change the session timeout for logged in users (i.e. after they
> successfully authenticated with your application), or special users
> (administrators with limited session time, etc). In those cases you
> already have a bound session, and you can use the previous call. If
> you want to specify session timeout for all users, then do it in your
> deployment descriptor.
>

Christoph's first message says: Now I want to make the time until the
application expires *configurable*


>
> http://stackoverflow.com/questions/15382895/session-timeout-in-web-xml
>
> Martijn
>
> On Wed, Oct 23, 2013 at 7:23 AM, Martin Grigorov <mg...@apache.org>
> wrote:
> > On Wed, Oct 23, 2013 at 2:36 AM, Joachim Schrod <js...@acm.org> wrote:
> >
> >> On 10/22/13 15:32, Martin Grigorov wrote:
> >> > On Tue, Oct 22, 2013 at 4:27 PM, Joachim Schrod <js...@acm.org>
> wrote:
> >> >
> >> >> On 10/22/13 10:34, Christoph.Manig@t-systems.com wrote:
> >> >> > If I do this in my WicketApplication class, in the init()
> >> >> > method I get java.lang.reflect.UndeclaredThrowableException.
> >> >> > But if I add this to my base page it works. Is there any
> >> >> > possibility to do this in the WicketApplication class?
> >> >>
> >> >> You have to redefine WebApplication#newSession().
> >> >>
> >> >> It can't be done in init(), as no session exists yet. And you must
> >> >> set the Session timeout for each new session anew.
> >> >>
> >> >> Without having tried it, code like
> >> >>
> >> >>     @Override
> >> >>     public Session newSession(Request request, Response response) {
> >> >>         Session session = super.newSession(request, response);
> >> >>
> >> >>
> >> >>
> >>
> ((ServletWebRequest)request).getContainerRequest().getSession().setMaxInactiveInterval(TIMEOUT);
> >> >>
> >> >
> >> > ALARM!
> >> > getSession() is the same as getSession(true). I.e. it will create a
> new
> >> > http session for each and every http request, even for static
> resources.
> >> >
> >> > Wicket creates Wicket Session when Session.get() is used, but creates
> >> Http
> >> > Session only when wicketSession.bind() is called.
> >>
> >> Interesting to hear; I'd have thought that works. Tricky thing,
> >> that. As I wrote, I didn't try the code; I just copied the access
> >> to HttpSession from the posts below.
> >>
> >> But, since wicketSession.bind() is final, one cannot subclass
> >> Session and redefine it either, to set the timeout there. (Much too
> >> many methods of Wicket classes are final, without really good
> >> reason; I copy them to my applications making the methods non-final
> >> much too often. :-( )
> >>
> >
> > If you override bind() and do something wrong then the functionality will
> > break completely.
> >
> >
> >>
> >> Martin, what would you propose to be the hook that allows to
> >> establish a different session timeout application-wide within your
> >> Java application? I hadn't had yet that case, web.xml suffices by
> >> now, but it would be good to know for the future.
> >>
> >
> > It is much better from framework point of view to give you a hook:
> >
> >
> org.apache.wicket.session.ISessionStore#getBindListeners().add(myListener)
> >
> >
> >>
> >> Cheers,
> >>         Joachim
> >>
> >> >>         return session;
> >> >>     }
> >> >>
> >> >> should work. Maybe check that request is really a
> >> >> ServletWebRequest. (This is also a good place to set the locale.)
> >> >>
> >> >> HTH,
> >> >>         Joachim
> >> >>
> >> >> >
> >> >> > -----Ursprüngliche Nachricht-----
> >> >> > Von: francois meillet [mailto:francois.meillet@gmail.com]
> >> >> > Gesendet: Montag, 21. Oktober 2013 16:34
> >> >> > An: users@wicket.apache.org
> >> >> > Betreff: Re: set session-timeout
> >> >> >
> >> >> > HttpSession httpSession = ((ServletWebRequest)
> >> >> RequestCycle.get().getRequest()).getContainerRequest().getSession();
> >> >> > httpSession.setMaxInactiveInterval(timeOut);
> >> >> >
> >> >> > François
> >> >> >
> >> >> >
> >> >> > On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <
> >> mgrigorov@apache.org
> >> >> >wrote:
> >> >> >
> >> >> >>
> >> >> >>
> >> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/a
> >> >> >> pi/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
> >> >> >>
> >> >> >>
> >> >> >> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com>
> >> wrote:
> >> >> >>
> >> >> >> > Hello,
> >> >> >> >
> >> >> >> > in my application i have set the errorpage for expired pages
> like
> >> >> this:
> >> >> >> >
> >> >> >> > getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
> >> >> >> >
> >> >> >> > Now I want to make the time until the application expires
> >> >> configurable.
> >> >> >> > How can I do this? Can I set this in the
> WicketApplication.init()?
> >> --
> >> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> >> Joachim Schrod, Roedermark, Germany
> >> Email: jschrod@acm.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AW: set session-timeout

Posted by Martijn Dashorst <ma...@gmail.com>.
AFAIK you can specify the session timeout in your web.xml or in your
container. I don't see why Wicket should get involved in that, other
than change the session timeout for logged in users (i.e. after they
successfully authenticated with your application), or special users
(administrators with limited session time, etc). In those cases you
already have a bound session, and you can use the previous call. If
you want to specify session timeout for all users, then do it in your
deployment descriptor.

http://stackoverflow.com/questions/15382895/session-timeout-in-web-xml

Martijn

On Wed, Oct 23, 2013 at 7:23 AM, Martin Grigorov <mg...@apache.org> wrote:
> On Wed, Oct 23, 2013 at 2:36 AM, Joachim Schrod <js...@acm.org> wrote:
>
>> On 10/22/13 15:32, Martin Grigorov wrote:
>> > On Tue, Oct 22, 2013 at 4:27 PM, Joachim Schrod <js...@acm.org> wrote:
>> >
>> >> On 10/22/13 10:34, Christoph.Manig@t-systems.com wrote:
>> >> > If I do this in my WicketApplication class, in the init()
>> >> > method I get java.lang.reflect.UndeclaredThrowableException.
>> >> > But if I add this to my base page it works. Is there any
>> >> > possibility to do this in the WicketApplication class?
>> >>
>> >> You have to redefine WebApplication#newSession().
>> >>
>> >> It can't be done in init(), as no session exists yet. And you must
>> >> set the Session timeout for each new session anew.
>> >>
>> >> Without having tried it, code like
>> >>
>> >>     @Override
>> >>     public Session newSession(Request request, Response response) {
>> >>         Session session = super.newSession(request, response);
>> >>
>> >>
>> >>
>> ((ServletWebRequest)request).getContainerRequest().getSession().setMaxInactiveInterval(TIMEOUT);
>> >>
>> >
>> > ALARM!
>> > getSession() is the same as getSession(true). I.e. it will create a new
>> > http session for each and every http request, even for static resources.
>> >
>> > Wicket creates Wicket Session when Session.get() is used, but creates
>> Http
>> > Session only when wicketSession.bind() is called.
>>
>> Interesting to hear; I'd have thought that works. Tricky thing,
>> that. As I wrote, I didn't try the code; I just copied the access
>> to HttpSession from the posts below.
>>
>> But, since wicketSession.bind() is final, one cannot subclass
>> Session and redefine it either, to set the timeout there. (Much too
>> many methods of Wicket classes are final, without really good
>> reason; I copy them to my applications making the methods non-final
>> much too often. :-( )
>>
>
> If you override bind() and do something wrong then the functionality will
> break completely.
>
>
>>
>> Martin, what would you propose to be the hook that allows to
>> establish a different session timeout application-wide within your
>> Java application? I hadn't had yet that case, web.xml suffices by
>> now, but it would be good to know for the future.
>>
>
> It is much better from framework point of view to give you a hook:
>
> org.apache.wicket.session.ISessionStore#getBindListeners().add(myListener)
>
>
>>
>> Cheers,
>>         Joachim
>>
>> >>         return session;
>> >>     }
>> >>
>> >> should work. Maybe check that request is really a
>> >> ServletWebRequest. (This is also a good place to set the locale.)
>> >>
>> >> HTH,
>> >>         Joachim
>> >>
>> >> >
>> >> > -----Ursprüngliche Nachricht-----
>> >> > Von: francois meillet [mailto:francois.meillet@gmail.com]
>> >> > Gesendet: Montag, 21. Oktober 2013 16:34
>> >> > An: users@wicket.apache.org
>> >> > Betreff: Re: set session-timeout
>> >> >
>> >> > HttpSession httpSession = ((ServletWebRequest)
>> >> RequestCycle.get().getRequest()).getContainerRequest().getSession();
>> >> > httpSession.setMaxInactiveInterval(timeOut);
>> >> >
>> >> > François
>> >> >
>> >> >
>> >> > On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <
>> mgrigorov@apache.org
>> >> >wrote:
>> >> >
>> >> >>
>> >> >>
>> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/a
>> >> >> pi/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
>> >> >>
>> >> >>
>> >> >> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com>
>> wrote:
>> >> >>
>> >> >> > Hello,
>> >> >> >
>> >> >> > in my application i have set the errorpage for expired pages like
>> >> this:
>> >> >> >
>> >> >> > getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
>> >> >> >
>> >> >> > Now I want to make the time until the application expires
>> >> configurable.
>> >> >> > How can I do this? Can I set this in the WicketApplication.init()?
>> --
>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>> Joachim Schrod, Roedermark, Germany
>> Email: jschrod@acm.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AW: set session-timeout

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Oct 23, 2013 at 2:36 AM, Joachim Schrod <js...@acm.org> wrote:

> On 10/22/13 15:32, Martin Grigorov wrote:
> > On Tue, Oct 22, 2013 at 4:27 PM, Joachim Schrod <js...@acm.org> wrote:
> >
> >> On 10/22/13 10:34, Christoph.Manig@t-systems.com wrote:
> >> > If I do this in my WicketApplication class, in the init()
> >> > method I get java.lang.reflect.UndeclaredThrowableException.
> >> > But if I add this to my base page it works. Is there any
> >> > possibility to do this in the WicketApplication class?
> >>
> >> You have to redefine WebApplication#newSession().
> >>
> >> It can't be done in init(), as no session exists yet. And you must
> >> set the Session timeout for each new session anew.
> >>
> >> Without having tried it, code like
> >>
> >>     @Override
> >>     public Session newSession(Request request, Response response) {
> >>         Session session = super.newSession(request, response);
> >>
> >>
> >>
> ((ServletWebRequest)request).getContainerRequest().getSession().setMaxInactiveInterval(TIMEOUT);
> >>
> >
> > ALARM!
> > getSession() is the same as getSession(true). I.e. it will create a new
> > http session for each and every http request, even for static resources.
> >
> > Wicket creates Wicket Session when Session.get() is used, but creates
> Http
> > Session only when wicketSession.bind() is called.
>
> Interesting to hear; I'd have thought that works. Tricky thing,
> that. As I wrote, I didn't try the code; I just copied the access
> to HttpSession from the posts below.
>
> But, since wicketSession.bind() is final, one cannot subclass
> Session and redefine it either, to set the timeout there. (Much too
> many methods of Wicket classes are final, without really good
> reason; I copy them to my applications making the methods non-final
> much too often. :-( )
>

If you override bind() and do something wrong then the functionality will
break completely.


>
> Martin, what would you propose to be the hook that allows to
> establish a different session timeout application-wide within your
> Java application? I hadn't had yet that case, web.xml suffices by
> now, but it would be good to know for the future.
>

It is much better from framework point of view to give you a hook:

org.apache.wicket.session.ISessionStore#getBindListeners().add(myListener)


>
> Cheers,
>         Joachim
>
> >>         return session;
> >>     }
> >>
> >> should work. Maybe check that request is really a
> >> ServletWebRequest. (This is also a good place to set the locale.)
> >>
> >> HTH,
> >>         Joachim
> >>
> >> >
> >> > -----Ursprüngliche Nachricht-----
> >> > Von: francois meillet [mailto:francois.meillet@gmail.com]
> >> > Gesendet: Montag, 21. Oktober 2013 16:34
> >> > An: users@wicket.apache.org
> >> > Betreff: Re: set session-timeout
> >> >
> >> > HttpSession httpSession = ((ServletWebRequest)
> >> RequestCycle.get().getRequest()).getContainerRequest().getSession();
> >> > httpSession.setMaxInactiveInterval(timeOut);
> >> >
> >> > François
> >> >
> >> >
> >> > On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <
> mgrigorov@apache.org
> >> >wrote:
> >> >
> >> >>
> >> >>
> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/a
> >> >> pi/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
> >> >>
> >> >>
> >> >> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com>
> wrote:
> >> >>
> >> >> > Hello,
> >> >> >
> >> >> > in my application i have set the errorpage for expired pages like
> >> this:
> >> >> >
> >> >> > getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
> >> >> >
> >> >> > Now I want to make the time until the application expires
> >> configurable.
> >> >> > How can I do this? Can I set this in the WicketApplication.init()?
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Joachim Schrod, Roedermark, Germany
> Email: jschrod@acm.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AW: set session-timeout

Posted by Joachim Schrod <js...@acm.org>.
On 10/22/13 15:32, Martin Grigorov wrote:
> On Tue, Oct 22, 2013 at 4:27 PM, Joachim Schrod <js...@acm.org> wrote:
> 
>> On 10/22/13 10:34, Christoph.Manig@t-systems.com wrote:
>> > If I do this in my WicketApplication class, in the init()
>> > method I get java.lang.reflect.UndeclaredThrowableException.
>> > But if I add this to my base page it works. Is there any
>> > possibility to do this in the WicketApplication class?
>>
>> You have to redefine WebApplication#newSession().
>>
>> It can't be done in init(), as no session exists yet. And you must
>> set the Session timeout for each new session anew.
>>
>> Without having tried it, code like
>>
>>     @Override
>>     public Session newSession(Request request, Response response) {
>>         Session session = super.newSession(request, response);
>>
>>
>> ((ServletWebRequest)request).getContainerRequest().getSession().setMaxInactiveInterval(TIMEOUT);
>>
> 
> ALARM!
> getSession() is the same as getSession(true). I.e. it will create a new
> http session for each and every http request, even for static resources.
> 
> Wicket creates Wicket Session when Session.get() is used, but creates Http
> Session only when wicketSession.bind() is called.

Interesting to hear; I'd have thought that works. Tricky thing,
that. As I wrote, I didn't try the code; I just copied the access
to HttpSession from the posts below.

But, since wicketSession.bind() is final, one cannot subclass
Session and redefine it either, to set the timeout there. (Much too
many methods of Wicket classes are final, without really good
reason; I copy them to my applications making the methods non-final
much too often. :-( )

Martin, what would you propose to be the hook that allows to
establish a different session timeout application-wide within your
Java application? I hadn't had yet that case, web.xml suffices by
now, but it would be good to know for the future.

Cheers,
	Joachim

>>         return session;
>>     }
>>
>> should work. Maybe check that request is really a
>> ServletWebRequest. (This is also a good place to set the locale.)
>>
>> HTH,
>>         Joachim
>>
>> >
>> > -----Ursprüngliche Nachricht-----
>> > Von: francois meillet [mailto:francois.meillet@gmail.com]
>> > Gesendet: Montag, 21. Oktober 2013 16:34
>> > An: users@wicket.apache.org
>> > Betreff: Re: set session-timeout
>> >
>> > HttpSession httpSession = ((ServletWebRequest)
>> RequestCycle.get().getRequest()).getContainerRequest().getSession();
>> > httpSession.setMaxInactiveInterval(timeOut);
>> >
>> > François
>> >
>> >
>> > On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <mgrigorov@apache.org
>> >wrote:
>> >
>> >>
>> >> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/a
>> >> pi/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
>> >>
>> >>
>> >> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com> wrote:
>> >>
>> >> > Hello,
>> >> >
>> >> > in my application i have set the errorpage for expired pages like
>> this:
>> >> >
>> >> > getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
>> >> >
>> >> > Now I want to make the time until the application expires
>> configurable.
>> >> > How can I do this? Can I set this in the WicketApplication.init()?
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jschrod@acm.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AW: set session-timeout

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Oct 22, 2013 at 4:27 PM, Joachim Schrod <js...@acm.org> wrote:

> On 10/22/13 10:34, Christoph.Manig@t-systems.com wrote:
> > If I do this in my WicketApplication class, in the init()
> > method I get java.lang.reflect.UndeclaredThrowableException.
> > But if I add this to my base page it works. Is there any
> > possibility to do this in the WicketApplication class?
>
> You have to redefine WebApplication#newSession().
>
> It can't be done in init(), as no session exists yet. And you must
> set the Session timeout for each new session anew.
>
> Without having tried it, code like
>
>     @Override
>     public Session newSession(Request request, Response response) {
>         Session session = super.newSession(request, response);
>
>
> ((ServletWebRequest)request).getContainerRequest().getSession().setMaxInactiveInterval(TIMEOUT);
>

ALARM!
getSession() is the same as getSession(true). I.e. it will create a new
http session for each and every http request, even for static resources.

Wicket creates Wicket Session when Session.get() is used, but creates Http
Session only when wicketSession.bind() is called.


>         return session;
>     }
>
> should work. Maybe check that request is really a
> ServletWebRequest. (This is also a good place to set the locale.)
>
> HTH,
>         Joachim
>
> >
> > -----Ursprüngliche Nachricht-----
> > Von: francois meillet [mailto:francois.meillet@gmail.com]
> > Gesendet: Montag, 21. Oktober 2013 16:34
> > An: users@wicket.apache.org
> > Betreff: Re: set session-timeout
> >
> > HttpSession httpSession = ((ServletWebRequest)
> RequestCycle.get().getRequest()).getContainerRequest().getSession();
> > httpSession.setMaxInactiveInterval(timeOut);
> >
> > François
> >
> >
> > On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
> >
> >>
> >> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/a
> >> pi/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
> >>
> >>
> >> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com> wrote:
> >>
> >> > Hello,
> >> >
> >> > in my application i have set the errorpage for expired pages like
> this:
> >> >
> >> > getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
> >> >
> >> > Now I want to make the time until the application expires
> configurable.
> >> > How can I do this? Can I set this in the WicketApplication.init()?
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Joachim Schrod, Roedermark, Germany
> Email: jschrod@acm.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AW: set session-timeout

Posted by Joachim Schrod <js...@acm.org>.
On 10/22/13 10:34, Christoph.Manig@t-systems.com wrote:
> If I do this in my WicketApplication class, in the init()
> method I get java.lang.reflect.UndeclaredThrowableException.
> But if I add this to my base page it works. Is there any
> possibility to do this in the WicketApplication class?

You have to redefine WebApplication#newSession().

It can't be done in init(), as no session exists yet. And you must
set the Session timeout for each new session anew.

Without having tried it, code like

    @Override
    public Session newSession(Request request, Response response) {
        Session session = super.newSession(request, response);

((ServletWebRequest)request).getContainerRequest().getSession().setMaxInactiveInterval(TIMEOUT);
	return session;
    }

should work. Maybe check that request is really a
ServletWebRequest. (This is also a good place to set the locale.)

HTH,
	Joachim

> 
> -----Ursprüngliche Nachricht-----
> Von: francois meillet [mailto:francois.meillet@gmail.com] 
> Gesendet: Montag, 21. Oktober 2013 16:34
> An: users@wicket.apache.org
> Betreff: Re: set session-timeout
> 
> HttpSession httpSession = ((ServletWebRequest) RequestCycle.get().getRequest()).getContainerRequest().getSession();
> httpSession.setMaxInactiveInterval(timeOut);
> 
> François
> 
> 
> On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <mg...@apache.org>wrote:
> 
>>
>> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/a
>> pi/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
>>
>>
>> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com> wrote:
>>
>> > Hello,
>> >
>> > in my application i have set the errorpage for expired pages like this:
>> >
>> > getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
>> >
>> > Now I want to make the time until the application expires configurable.
>> > How can I do this? Can I set this in the WicketApplication.init()?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jschrod@acm.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


AW: set session-timeout

Posted by Ch...@t-systems.com.
If I do this in my WicketApplication class, in the init() method I get java.lang.reflect.UndeclaredThrowableException. But if I add this to my base page it works. Is there any possibility to do this in the WicketApplication class?


Mit freundlichen Grüßen
Christoph Manig
Systems Engineer

T-Systems International GmbH
Systems Integration - SC Travel, Transport & Logistics
Hoyerswerdaer Str. 18
01099 Dresden 
tel.:	+49 (0) 351 / 8152 - 188
fax:	+49 (0) 351 / 8152 - 209
email:  Christoph.Manig@t-systems.com

-----Ursprüngliche Nachricht-----
Von: francois meillet [mailto:francois.meillet@gmail.com] 
Gesendet: Montag, 21. Oktober 2013 16:34
An: users@wicket.apache.org
Betreff: Re: set session-timeout

HttpSession httpSession = ((ServletWebRequest) RequestCycle.get().getRequest()).getContainerRequest().getSession();
httpSession.setMaxInactiveInterval(timeOut);

François


On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <mg...@apache.org>wrote:

>
> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/a
> pi/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
>
>
> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com> wrote:
>
> > Hello,
> >
> > in my application i have set the errorpage for expired pages like this:
> >
> > getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
> >
> > Now I want to make the time until the application expires configurable.
> > How can I do this? Can I set this in the WicketApplication.init()?
> >
> >
> > Mit freundlichen Grüßen
> > Christoph Manig
> > Systems Engineer
> >
> > T-Systems International GmbH
> > Systems Integration - SC Travel, Transport & Logistics Hoyerswerdaer 
> > Str. 18
> > 01099 Dresden
> > tel.:   +49 (0) 351 / 8152 - 188
> > fax:    +49 (0) 351 / 8152 - 209
> > email:  Christoph.Manig@t-systems.com
> >
> >
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: set session-timeout

Posted by Michael Haitz <mi...@1und1.de>.
or you can add the following snippet to your web.xml:

<session-config>    
    <session-timeout>TIME_IN_MINUTES</session-timeout>
</session-config>

cheers,
Michael

Am 21.10.2013 um 16:34 schrieb francois meillet <fr...@gmail.com>:

> HttpSession httpSession = ((ServletWebRequest)
> RequestCycle.get().getRequest()).getContainerRequest().getSession();
> httpSession.setMaxInactiveInterval(timeOut);
> 
> François
> 
> 
> On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <mg...@apache.org>wrote:
> 
>> 
>> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/api/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
>> 
>> 
>> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com> wrote:
>> 
>>> Hello,
>>> 
>>> in my application i have set the errorpage for expired pages like this:
>>> 
>>> getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
>>> 
>>> Now I want to make the time until the application expires configurable.
>>> How can I do this? Can I set this in the WicketApplication.init()?
>>> 
>>> 
>>> Mit freundlichen Grüßen
>>> Christoph Manig
>>> Systems Engineer
>>> 
>>> T-Systems International GmbH
>>> Systems Integration - SC Travel, Transport & Logistics
>>> Hoyerswerdaer Str. 18
>>> 01099 Dresden
>>> tel.:   +49 (0) 351 / 8152 - 188
>>> fax:    +49 (0) 351 / 8152 - 209
>>> email:  Christoph.Manig@t-systems.com
>>> 
>>> 
>>> 
>>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: set session-timeout

Posted by francois meillet <fr...@gmail.com>.
HttpSession httpSession = ((ServletWebRequest)
RequestCycle.get().getRequest()).getContainerRequest().getSession();
httpSession.setMaxInactiveInterval(timeOut);

François


On Mon, Oct 21, 2013 at 4:12 PM, Martin Grigorov <mg...@apache.org>wrote:

>
> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/api/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)
>
>
> On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com> wrote:
>
> > Hello,
> >
> > in my application i have set the errorpage for expired pages like this:
> >
> > getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
> >
> > Now I want to make the time until the application expires configurable.
> > How can I do this? Can I set this in the WicketApplication.init()?
> >
> >
> > Mit freundlichen Grüßen
> > Christoph Manig
> > Systems Engineer
> >
> > T-Systems International GmbH
> > Systems Integration - SC Travel, Transport & Logistics
> > Hoyerswerdaer Str. 18
> > 01099 Dresden
> > tel.:   +49 (0) 351 / 8152 - 188
> > fax:    +49 (0) 351 / 8152 - 209
> > email:  Christoph.Manig@t-systems.com
> >
> >
> >
> >
>

Re: set session-timeout

Posted by Martin Grigorov <mg...@apache.org>.
http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/api/javax/servlet/http/HttpSession.html#setMaxInactiveInterval(int)


On Mon, Oct 21, 2013 at 4:44 PM, <Ch...@t-systems.com> wrote:

> Hello,
>
> in my application i have set the errorpage for expired pages like this:
>
> getApplicationSettings().setPageExpiredErrorPage(Timeout.class);
>
> Now I want to make the time until the application expires configurable.
> How can I do this? Can I set this in the WicketApplication.init()?
>
>
> Mit freundlichen Grüßen
> Christoph Manig
> Systems Engineer
>
> T-Systems International GmbH
> Systems Integration - SC Travel, Transport & Logistics
> Hoyerswerdaer Str. 18
> 01099 Dresden
> tel.:   +49 (0) 351 / 8152 - 188
> fax:    +49 (0) 351 / 8152 - 209
> email:  Christoph.Manig@t-systems.com
>
>
>
>