asking the container to notify your application whenever a session is about to timeout in Java
Posted
by
user136101
on Stack Overflow
See other posts from Stack Overflow
or by user136101
Published on 2009-10-08T12:54:19Z
Indexed on
2010/12/21
7:54 UTC
Read the original article
Hit count: 268
Which method(s) can be used to ask the container to notify your application whenever a session is about to timeout?(choose all that apply)
A. HttpSessionListener.sessionDestroyed -- correct
B. HttpSessionBindingListener.valueBound
C. HttpSessionBindingListener.valueUnbound -- correct this is kind of round-about but if you have an attribute class this is a way to be informed of a timeout
D. HttpSessionBindingEvent.sessionDestroyed -- no such method
E. HttpSessionAttributeListener.attributeRemoved -- removing an attribute isn’t tightly associated with a session timeout
F. HttpSessionActivationListener.sessionWillPassivate -- session passivation is different than timeout
I agree with option A.
1) But C is doubtful
How can value unbound be tightly coupled with session timeout.It is just the callback method when an attribute gets removed.
2) and if C is correct, E should also be correct.
HttpSessionAttributeListener is just a class that wants to know when any type of attribute has been added, removed, or replaced in a session. It is implemented by any class.
HttpSessionBindingListener exists so that the attribute itself can find out when it has been added to or removed from a session and the attribute class must implement this interface to achieve it.
Any ideas…
© Stack Overflow or respective owner