users@glassfish.java.net

Re: HttpSessionListener question

From: <glassfish_at_javadesktop.org>
Date: Fri, 29 Feb 2008 19:23:20 PST

This is a bug in GlassFish: An HttpSessionListener should be called at is sessionDestroyed() method before the session attributes are removed.

The diffs below fix the issue.

Can you please file a bug in IssueTracker against the web-container?

Index: StandardSession.java
===================================================================
RCS file: /cvs/glassfish/appserv-webtier/src/java/org/apache/catalina/session/StandardSession.java,v
retrieving revision 1.34.6.7
diff -u -r1.34.6.7 StandardSession.java
--- StandardSession.java 10 Dec 2007 23:21:08 -0000 1.34.6.7
+++ StandardSession.java 1 Mar 2008 03:06:40 -0000
@@ -854,6 +854,11 @@
                 }
             }

+ // Notify interested session event listeners
+ if (notify) {
+ fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
+ }
+
             /*
              * Mark session as expired *before* removing its attributes, so
              * that its HttpSessionBindingListener objects will get an
@@ -866,12 +871,6 @@
             String keys[] = keys();
             for (int i = 0; i < keys.length; i++)
                 removeAttribute(keys[i], notify, false);
-
- // Notify interested session event listeners
- if (notify) {
- fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
- }
-
         }

     }
[Message sent by forum member 'jluehe' (jluehe)]

http://forums.java.net/jive/thread.jspa?messageID=261741