You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bryan Lewis <br...@maine.rr.com> on 2004/09/13 02:38:43 UTC

Re: Server Side Session Expiration

There was a good discussion of this on about June 15th... search for
HttpSessionListener.  I've been using that technique to count the number of
sessions created and destroyed.  However, it isn't so easy to get a
reference to the Visit object.  When I tried to do that with code like this:

    public void sessionDestroyed(HttpSessionEvent se) {
        String engineKey = "org.apache.tapestry.engine:" + appName;
        BaseEngine oldEngine = (BaseEngine) session.getAttribute(engineKey);
        Visit visit = (Visit) oldEngine.getVisit();

I got an exception:

    java.lang.IllegalStateException: getAttribute: Session already
invalidated

In my case I only wanted to determine which user was associated with the
expired session.  I did a little experimenting and I believe I can do it
with a brute-force approach -- keep a map of the user names associated with
the session toString() ID's as they're created.  The user name can then be
looked up in sessionDestroyed(), since toString() does work there.

In your case, retrieving data from the visit might not be possible.  Let us
know if you find a way.


----- Original Message ----- 
From: "Jordan Redner" <jr...@shopping.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Saturday, September 11, 2004 12:36 PM
Subject: Server Side Session Expiration


I have the need to trap a server side session expiration event and get a
handle on the Visit Object to save some state.

Is there a way to do this, and what is the recommended approach?


Thanks!

Jordan



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org