On 7/31/05, Tamas Szabo <[EMAIL PROTECTED]> wrote: > Craig McClanahan wrote: > >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?
There is no "one size fits all" answer to this question. A couple alternative approaches: * Make sure that there is no "some reason" to remove this attribute *unless* you are terminating the session, or it is timing out. That way, the meaning of this attribute being removed would be unambiguous. (You could even have a special attribute reserved for this purpose, although you are not going to have any guarantees on the order in which the attributes are being removed.) * Prior to calling session.invalidate(), set a flagging attribute of some sort that notifies your listener "I am about to invalidate this session. This won't get done on session timeouts, though. > > Tamas > Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]