tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bigwood, David" <dbigw...@metatomix.com>
Subject SessionListener sessionDestroyed() - session already invalidated - Tomcat 4.0.2
Date Wed, 20 Feb 2002 15:11:25 GMT

I am having issues getting useful functionality with code that
implements Servlet 2.3 HttpSessionListener. The code was intended to
provide some enhancements to a logging suite to carry out some tasks
BEFORE a session is actually destroyed.

My intention is to gather some interesting data about a visit for
tracking purposes, e.g.: page count, page history, session duration,
session create time, entry page, exit page, etc. (some of this data is
inserted during the session).

However, the existing sessionDestroyed method:

public void sessionDestroyed(HttpSessionEvent hse) 

while allowing access to the current session ID via:

hse.getSession().getId();

does not appear to allow access to any data that is/was stored in the
session and results in a message along the lines of:

"session already invalidated"

Having checked the code in
org/apache/catalina/session/StandardSession.java, specifically the
method:

public void expire(boolean notify)

the reason would appear to be because the session is marked as invalid:

setValid(false);

BEFORE the call to the session destroyed event of each session listener:

if (notify) {
	fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
}


My question is this:

Is there a specific reason why the session is invalidated BEFORE expire
calls the session listeners, or could we move the setValid(false) call
down?

If there is no reason I will propose a patch to make it so.

Would be interested in your thoughts.
-David 


----
David Bigwood
VP Engineering, Metatomix
mailto: dbigwood@metatomix.com
T: 781 895 4803
F: 781 487 7711
C: 781 983 1699

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message