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: [EMAIL PROTECTED]
T: 781 895 4803
F: 781 487 7711
C: 781 983 1699

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to