[jboss-cvs] JBossAS SVN: r57276 - branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 28 23:45:33 EDT 2006


Author: ryan.campbell at jboss.com
Date: 2006-09-28 23:45:30 -0400 (Thu, 28 Sep 2006)
New Revision: 57276

Added:
   branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/JvmRouteValve.java
Modified:
   branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/ClusteredSession.java
   branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/JBossManager.java
Log:
ASPATCH-48: JBAS-2098: Patch request: JvmRouteFilter not activated when using Tomcat clustering with mod_jk

Modified: branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/ClusteredSession.java
===================================================================
--- branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/ClusteredSession.java	2006-09-29 03:21:14 UTC (rev 57275)
+++ branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/ClusteredSession.java	2006-09-29 03:45:30 UTC (rev 57276)
@@ -83,7 +83,19 @@
       isOutdated = outdated;
    }
 
+
    /**
+    * This is called specifically for failover case using mod_jk where the new session has this node name in
+    * there. As a result, it is safe to just replace the id since the backend store is using the "real" id
+    * without the node name.
+    * @param id
+    */
+   public void resetIdWithRouteInfo(String id)
+   {
+      this.id = id;
+   }
+
+   /**
     * Check to see if the input version number is greater than I am. If it is, it means we will
     * need to invalidate the in-memory cache.
     * @param version

Modified: branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/JBossManager.java
===================================================================
--- branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/JBossManager.java	2006-09-29 03:21:14 UTC (rev 57275)
+++ branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/JBossManager.java	2006-09-29 03:45:30 UTC (rev 57276)
@@ -33,7 +33,10 @@
 import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.Session;
 import org.apache.catalina.util.LifecycleSupport;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.connector.Response;
 
+
 /**
  * Base abstract implementation of Tomcat manager without the concept of
  * session operations, e.g., add, remove, etc.
@@ -227,6 +230,8 @@
       if (response != null)
       {
          Context context = (Context) container_;
+         Connector connector = ((Response)response).getConnector();
+
          if (context.getCookies())
          {
             // set a new session cookie
@@ -235,10 +240,26 @@
             {
                log_.debug("Setting cookie with session id:" + sessionId + " & name:" + Globals.SESSION_COOKIE_NAME);
             }
-            newCookie.setMaxAge(-1);
-            newCookie.setPath(context.getPath());
+
+            String contextPath = null;
+            if (!connector.getEmptySessionPath() && (context != null)) {
+                contextPath = context.getEncodedPath();
+            }
+
+            if ((contextPath != null) && (contextPath.length() > 0)) {
+                newCookie.setPath(contextPath);
+            } else {
+                newCookie.setPath("/");
+            }
+
+
+            if (connector.getSecure()) {
+                newCookie.setSecure(true);
+            }
+
             response.addCookie(newCookie);
          }
+
       }
    }
 

Copied: branches/JBoss_4_0_2_CP/tomcat/src/main/org/jboss/web/tomcat/tc5/session/JvmRouteValve.java (from rev 57275, branches/JBoss_4_0_2_JBAS-2034/tomcat/src/main/org/jboss/web/tomcat/tc5/session/JvmRouteValve.java)




More information about the jboss-cvs-commits mailing list