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…