Craig McClanahan wrote:

On 7/29/05, Varley, Roger <[EMAIL PROTECTED]> wrote:
I could be losing my mind, but, I swear that I tried this technique
once and by the time the sessionDestroyed() method was called, I was
not able to get any of the session attributes back anymore. For
various reasons, the webapps I develop need to be deployable in a
Servlet 2.3 environment. Is this something where the behavior changed
for the better in Servlet 2.4 versus 2.3?

</Lurk>
No, you are not loosing your mind. The Servlet 2.3 specification defines 
HttpSessionListener#SessionDestroyed as "Notification that a session was invalidated". 
Thus anyone who followed the specification to the letter, as many container authors did, ended up 
with a method that was somewhat less than useful. In the 2.4 specification, the wording was changed 
to "Notification that a session is about to be invalidated".


One approach to consider is to make your listener implement
HttpSessionAttributeListener as well as HttpSessionListener.  That
means you'll hear about session attributes being removed -- which is
what happens as the session is being invalidated or timed out.  All of
these calls will happen before the sessionDestroyed() notification.


But how would you know that the attribute was removed because sessionDestroyed will be called or
because some code in the application removed the attribute for some reason?

Tamas


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

Reply via email to