I think in servlet spec 2.4 there is an event generated just before the session is invalidated. Until then:

I implemented a HttpSessionAttributeListener. When a session is about to be invalidated all its attributes are removed. So, if you have an attribute which lasts for the lifetime of the session you can do your session clean-up when it gets removed :)

Also, if you have session persistance turned on sessionDestroyed(...) won't necessarily be called when you shut down tomcat. It may be called when you start up tomcat again later and the persisted session immediately times out ;)

Jon

Alexander Wallace wrote:
I tryed that but when I do getAttribute("myObj") from the session, I get an error saying that the session has already been invalidated.

Any clues?

On Friday 14 March 2003 13:17, Shapira, Yoav wrote:

Howdy,
In a SessionListener's sessionDestroyed() method, the HttpSessionEvent
argument has a getSession() method you get use to get the Session
itself, and then do getAttribute("...") on the session to get the
object.

Yoav Shapira
Millennium ChemInformatics




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



Reply via email to