>From all I've heard, that's the only reliable way to detect that a session
has timed out.  It's an asynchronous event outside your app's control.

You could check for a valid session by looking for some known object in the
visit, for instance the user object.  If you did that in some base-class
method that gets called frequently enough (getPage() or getUser()), you
might be able to detect a closed session before it caused any surprises for
your pages.  My Visit.getUser() method throws a StaleSessionException if
user == null, to avoid null-user checks throughout my page code.  It works
but it's a bit messy and I'm not sure it's saved me that much effort... for
example, I have to be careful not to call getUser() when I merely want to
check whether the user is logged in without the side effect.

If you're trying to avoid adding such plumbing code to your app, you could
do it with an external servlet filter.  This site
http://www.jspbook.com/code.jsp has code for a dead-simple filter
(ConcurentUserTracker) that counts sessions. However, this would make it
harder for your app to act upon the session closing.  Depends on what you
want to achieve.


----- Original Message ----- 
From: "Jacob Lauem�ller" <[EMAIL PROTECTED]>
To: "'Tapestry users'" <[email protected]>
Sent: Thursday, June 09, 2005 5:09 AM
Subject: How to detect session close


> Hi all,
>
> Can I somehow detect that the current session is being closed without
> resorting to using a HTTPSessionListener directly?
>
> Regards,
> Jacob
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to