Hi,

I have a web application (Tomcat 4, Servlet 2.3 API) which does some
tracking of per-session information.  What I'd like to do is catch
session termination by using sessionDestroyed() in an
HttpSessionListener in order to do some cleanup, store some session
reporting information to a database, and so on.

Unfortunately, I can't do that because sessionDestroyed() is called
*after* the session is invalidated - this means that while I can get the
sessionId, I can't get any of the other session attributes like creation
time or last access time.

This is an unfortunate inconsistency with contextDestroyed() in
ServletContextListener which is called when the context is about to shut
down. This seems a much more useful pattern.

So what's the right way to what I'm attempting?  Clearly I can use
HttpSessionListener to store some session information at session
creation using sessionCreated() and then pull it out again in
sessionDestroyed(), but this seems to be reinventing the wheel a little.

Is there a standard way to do this within the API or do I need to roll
my own solution?

--
Andy Ormsby
Lexicle
www.lexicle.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to