HttpSessionBindingEvents occur when an attribute is removed from the session.  since 
invalidate() first invalidates the session, then removes any bound objects, the call 
would happen in both cases, so you don't need the removeAttribute() calls so long as 
the invalidate() call remains.

"Nocera, Robert" wrote:

> I believe that according to the spec the unBound event should occur when a
> session.invalidate() occurs.  I have noticed that some containers have
> problems with that however.  Tomcat seems to implement this correctly.
>
> -Rob
>
> -----Original Message-----
> From: Brian K. Buckley [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 05, 2001 11:17 AM
> To: [EMAIL PROTECTED]
> Subject: Re: LogoffAction example
>
> Alright :).
>
> I was thinking it might have been intentional to give any
> HttpSessionListeners a chance to do something.
>
> I'm not clear on when HttpSessionBindingEvents occur - do they happen
> automatically when a session timesout or sesion.invalidate() is called, or
> do they happen only when it removeAttribute() is explicitly called as in
> LogoffAction?
>
> - Brian
>
> > Thats what is called as paranoid cleanup-lol
>
> > >Hi, In LogoffAction in the struts example,  the main three lines are:
> > >
> > >session.removeAttribute(Constants.SUBSCRIPTION_KEY);
> > >session.removeAttribute(Constants.USER_KEY);
> > >session.invalidate();
> > >
> > >What is the purpose of the first two lines - why bother removing the
> items
> > >right before the session is invalidated?
>
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is confidential and may be 
>privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone 
>else is unauthorized. If you are not an addressee, any disclosure or copying of the 
>contents of this E-mail or any action taken (or not taken) in reliance on it is 
>unauthorized and may be unlawful. If you are not an addressee, please inform the 
>sender immediately.


Reply via email to