You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jonas <ba...@gmail.com> on 2009/08/19 12:26:10 UTC

Re: Session listener

I think overriding WebApplication#sessionDestroyed should do the trick.

On Wed, Aug 19, 2009 at 12:26 PM, David Leangen<wi...@leangen.net> wrote:
>
> Hi!
>
> What's the best way to get notified of a session timeout event from within a
> Wicket App when I don't have access to the deployment descriptor?
>
> All I need is the ID of the session that expired.
>
>
> Thanks!
> =David
>
>
>
> ---------------------------------------------------------------------
> 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: Session listener

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
I don't know why you want to access the deployment descriptor, but this is
how I did it (UsageStatistics is a selfmade class):

In WebApplication subclass:

    @Override
    protected ISessionStore newSessionStore() {
        return new SecondLevelCacheSessionStore(this, new DiskPageStore()){
            @Override
            protected void onUnbind(String sessionId) {
                getUsageStatistics().registerSessionDestroyed(sessionId);
                super.onUnbind(sessionId);
            }
            @Override
            protected void onBind(Request request, Session newSession) {
                super.onBind(request, newSession);
                getUsageStatistics().registerNewSession((WebRequest)request,
(JobIQSession)newSession);
            }
        };
    }

You van use
((WebRequest)request).getHttpServletRequest().getSession().getMaxInactiveInterval()
to get the timeout interval

2009/8/20 David Leangen <wi...@leangen.net>

>
>
>  What's the best way to get notified of a session timeout event from within
>>> a
>>> Wicket App when I don't have access to the deployment descriptor?
>>>
>>
>  I think overriding WebApplication#sessionDestroyed should do the trick.
>>
>
> Perfect! Thank you.
>
>


-- 
Martijn Lindhout
* 06 - 18 47 25 29
* mlindhout@jointeffort.nl
* http://www.jointeffort.nl

Re: Session listener

Posted by David Leangen <wi...@leangen.net>.

>> What's the best way to get notified of a session timeout event from  
>> within a
>> Wicket App when I don't have access to the deployment descriptor?

> I think overriding WebApplication#sessionDestroyed should do the  
> trick.

Perfect! Thank you.