tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1160227 - in /tomcat/tc5.5.x/trunk: ./ container/catalina/src/share/org/apache/catalina/ container/catalina/src/share/org/apache/catalina/session/ container/modules/cluster/src/share/org/apache/catalina/cluster/session/ container/modules/h...
Date Mon, 22 Aug 2011 12:06:01 GMT
Author: kkolinko
Date: Mon Aug 22 12:06:00 2011
New Revision: 1160227

URL: http://svn.apache.org/viewvc?rev=1160227&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51042
Don't notify session creation listeners when changing session ID on authentication
(markt)

Modified:
    tomcat/tc5.5.x/trunk/STATUS.txt
    tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/Session.java
    tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java
    tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/StandardSession.java
    tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
    tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
    tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java
    tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaManager.java
    tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java
    tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java
    tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml

Modified: tomcat/tc5.5.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/STATUS.txt (original)
+++ tomcat/tc5.5.x/trunk/STATUS.txt Mon Aug 22 12:06:00 2011
@@ -25,13 +25,6 @@ $Id$
 PATCHES PROPOSED TO BACKPORT:
   [ New proposals should be added at the end of the list ]
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51042
-  Don't notify session creation listeners when changing session ID on
-  authentication
-  http://people.apache.org/~markt/patches/2011-08-18-bug51042-tc55.patch
-  +1: markt, schultz, kkolinko
-  -1:
-
 * Multiple improvements to the Windows Installer
   - https://issues.apache.org/bugzilla/show_bug.cgi?id=33262
     Install monitor to auto-start for current user only rather than all users to

Modified: tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/Session.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/Session.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/Session.java (original)
+++ tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/Session.java Mon
Aug 22 12:06:00 2011
@@ -111,7 +111,8 @@ public interface Session {
 
 
     /**
-     * Set the session identifier for this session.
+     * Set the session identifier for this session and notifies any associated
+     * listeners that a new session has been created.
      *
      * @param id The new session identifier
      */
@@ -119,6 +120,17 @@ public interface Session {
 
 
     /**
+     * Set the session identifier for this session and optionally notifies any
+     * associated listeners that a new session has been created.
+     *
+     * @param id        The new session identifier
+     * @param notify    Should any associated listeners be notified that a new
+     *                      session has been created? 
+     */
+    public void setId(String id, boolean notify);
+
+
+    /**
      * Return descriptive information about this Session implementation and
      * the corresponding version number, in the format
      * <code>&lt;description&gt;/&lt;version&gt;</code>.

Modified: tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java
(original)
+++ tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java
Mon Aug 22 12:06:00 2011
@@ -943,7 +943,7 @@ public abstract class ManagerBase implem
      * @param session   The session to change the session ID for
      */
     public void changeSessionId(Session session) {
-        session.setId(generateSessionId());
+        session.setId(generateSessionId(), false);
     }
     
     

Modified: tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/StandardSession.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/StandardSession.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/StandardSession.java
(original)
+++ tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/StandardSession.java
Mon Aug 22 12:06:00 2011
@@ -348,6 +348,10 @@ public class StandardSession
      * @param id The new session identifier
      */
     public void setId(String id) {
+        setId(id, true);
+    }
+    
+    public void setId(String id, boolean notify) {
 
         if ((this.id != null) && (manager != null))
             manager.remove(this);
@@ -356,7 +360,10 @@ public class StandardSession
 
         if (manager != null)
             manager.add(this);
-        tellNew();
+
+        if(notify) {
+            tellNew();
+        }
     }
 
 

Modified: tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
(original)
+++ tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
Mon Aug 22 12:06:00 2011
@@ -1775,12 +1775,7 @@ public class DeltaManager extends Manage
         session.setMaxInactiveInterval(getMaxInactiveInterval());
         session.setExpireTolerance(this.expireTolerance);
         session.access();
-        if(notifySessionListenersOnReplication) {
-            session.setId(msg.getSessionID());
-        } else {
-            session.setIdInternal(msg.getSessionID());
-            add(session);
-        }
+        session.setId(msg.getSessionID(), notifySessionListenersOnReplication);
         session.resetDeltaRequest();
         session.endAccess();
 
@@ -1871,12 +1866,7 @@ public class DeltaManager extends Manage
         if (session != null) {
             String newSessionID = deserializeSessionId(msg.getSession());
             session.setPrimarySession(false);
-            if (notifySessionListenersOnReplication) {
-                session.setId(newSessionID);
-            } else {
-                session.setIdInternal(newSessionID);
-                add(session);
-            }
+            session.setId(newSessionID, notifySessionListenersOnReplication);
         }
     }
 

Modified: tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
(original)
+++ tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java
Mon Aug 22 12:06:00 2011
@@ -388,10 +388,16 @@ public class DeltaSession implements Htt
      *            The new session identifier
      */
     public void setId(String id) {
-        setIdInternal(id);
-        tellNew();
+        setId(id, true);
      }
 
+    public void setId(String id, boolean notify) {
+        setIdInternal(id);
+        if(notify) {
+            tellNew();
+        }
+    }
+
     /**
      * Inform the listeners about the new session.
      *  

Modified: tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java
(original)
+++ tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java
Mon Aug 22 12:06:00 2011
@@ -375,8 +375,7 @@ public class JvmRouteBinderValve extends
             Response response, String sessionId, String newSessionID, Session catalinaSession)
{
         lifecycle.fireLifecycleEvent("Before session migration",
                 catalinaSession);
-        // FIXME: setId trigger session Listener, but only chance to registiert manager with
correct id!
-        catalinaSession.setId(newSessionID);
+        catalinaSession.setId(newSessionID, false);
         // FIXME: Why we remove change data from other running request?
         // setId also trigger resetDeltaRequest!!
         if (catalinaSession instanceof DeltaSession)

Modified: tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaManager.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaManager.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaManager.java
(original)
+++ tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaManager.java
Mon Aug 22 12:06:00 2011
@@ -1518,10 +1518,7 @@ public class DeltaManager extends Cluste
         session.setPrimarySession(false);
         session.setCreationTime(msg.getTimestamp());
         session.access();
-        if(notifySessionListenersOnReplication)
-            session.setId(msg.getSessionID());
-        else
-            session.setIdInternal(msg.getSessionID());
+        session.setId(msg.getSessionID(), notifySessionListenersOnReplication);
         session.resetDeltaRequest();
         session.endAccess();
 
@@ -1597,12 +1594,7 @@ public class DeltaManager extends Cluste
         if (session != null) {
             String newSessionID = deserializeSessionId(msg.getSession());
             session.setPrimarySession(false);
-            if (notifySessionListenersOnReplication) {
-                session.setId(newSessionID);
-            } else {
-                session.setIdInternal(newSessionID);
-                add(session);
-            }
+            session.setId(newSessionID, notifySessionListenersOnReplication);
         }
     }
 

Modified: tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java
(original)
+++ tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java
Mon Aug 22 12:06:00 2011
@@ -239,10 +239,13 @@ public class DeltaSession extends Standa
      *            The new session identifier
      */
     public void setId(String id) {
-        setIdInternal(id);
+        setId(id, true);
     }
 
-   
+    public void setId(String id, boolean notify) {
+        super.setId(id, notify);
+        resetDeltaRequest();
+    }
 
     /**
      * Return the last client access time without invalidation check

Modified: tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java
(original)
+++ tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java
Mon Aug 22 12:06:00 2011
@@ -375,8 +375,7 @@ public class JvmRouteBinderValve extends
             Response response, String sessionId, String newSessionID, Session catalinaSession)
{
         lifecycle.fireLifecycleEvent("Before session migration",
                 catalinaSession);
-        // FIXME: setId trigger session Listener, but only chance to registiert manager with
correct id!
-        catalinaSession.setId(newSessionID);
+        catalinaSession.setId(newSessionID, false);
         // FIXME: Why we remove change data from other running request?
         // setId also trigger resetDeltaRequest!!
         if (catalinaSession instanceof DeltaSession)

Modified: tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml?rev=1160227&r1=1160226&r2=1160227&view=diff
==============================================================================
--- tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml (original)
+++ tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml Mon Aug 22 12:06:00 2011
@@ -65,6 +65,10 @@
         MemoryUserDatabase via JMX. (markt)
       </fix>
       <fix>
+        <bug>51042</bug>: Don&apos;t trigger session creation listeners when
a
+        session ID is changed as part of the authentication process. (markt)
+      </fix>
+      <fix>
         <bug>51324</bug>: Improve handling of exceptions when flushing the
         response buffer to ensure that the doFlush flag does not get stuck in
         the enabled state. Patch provided by Jeremy Norris. (kkolinko)



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


Mime
View raw message