Hi, I am using Tomcat 4.1.18, and i want to do some database operation when the session times out. As per servlet 2.3 spec, valueUnbound has to be called on the object which implements HttpSessionBindingListener, It looks like tomcat is not calling that. Is there any other way, or am i wrong in saying that tomcat is not working ? Thanks & Regards, Micheal
From section 7.4 of the spec: The valueUnbound method must be called after the object is no longer available via the getAttribute method of the HttpSession interface.
Which is true if the session times out, right? The language of this particular section of the spec allows this fuzzy interpretation. What's more important to realize here is that if a session has expired, then NONE of the objects previously bound to it are avaiable, since the session itself is unavailable. The session unavailability 'supercedes' the unavailability of any object bound to that session. So perhaps there is no clear-cut requirement for the HttpSessionBindingListener to be notified.
From the API for Session.removeAttribute method: After this method executes, and if the object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueUnbound.
Here we find the normal course of events that triggers a notification of valueUnbound.
Check out section 10 of the spec, 'application lifecycle events' and the HttpSessionListener interface. [ October 26, 2003: Message edited by: Mike Curwen ]
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad: