Author: markt
Date: Fri Aug 26 16:09:44 2011
New Revision: 1162152

URL: http://svn.apache.org/viewvc?rev=1162152&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51558
No need to force the use of the StandardManager with addWebapp() since 
StandardContext will add it if it is not set.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tomcat.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestTomcat.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 26 16:09:44 2011
@@ -1 +1 @@
-/tomcat/trunk:1156171,1156276,1156304,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082
+/tomcat/trunk:1156171,1156276,1156304,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tomcat.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=1162152&r1=1162151&r2=1162152&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tomcat.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tomcat.java Fri Aug 
26 16:09:44 2011
@@ -55,7 +55,6 @@ import org.apache.catalina.core.Standard
 import org.apache.catalina.deploy.LoginConfig;
 import org.apache.catalina.realm.GenericPrincipal;
 import org.apache.catalina.realm.RealmBase;
-import org.apache.catalina.session.StandardManager;
 
 // TODO: lazy init for the temp dir - only when a JSP is compiled or 
 // get temp dir is called we need to create it. This will avoid the 
@@ -747,7 +746,6 @@ public class Tomcat {
         ctx.addServletMapping("*.jspx", "jsp");
 
         // Sessions
-        ctx.setManager( new StandardManager());
         ctx.setSessionTimeout(30);
         
         // MIME mappings

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestTomcat.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestTomcat.java?rev=1162152&r1=1162151&r2=1162152&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestTomcat.java 
(original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestTomcat.java Fri 
Aug 26 16:09:44 2011
@@ -35,6 +35,7 @@ import javax.naming.NamingException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
@@ -51,7 +52,7 @@ import org.apache.tomcat.util.buf.ByteCh
 public class TestTomcat extends TomcatBaseTest {
 
     /**
-     * Simple servlet to test in-line registration 
+     * Simple servlet to test in-line registration.
      */
     public static class HelloWorld extends HttpServlet {
 
@@ -65,6 +66,22 @@ public class TestTomcat extends TomcatBa
     }
 
     /**
+     * Simple servlet to test the default session manager.
+     */
+    public static class HelloWorldSession extends HttpServlet {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public void doGet(HttpServletRequest req, HttpServletResponse res) 
+                throws IOException {
+            HttpSession s = req.getSession(true);
+            s.getId();
+            res.getWriter().write("Hello world");
+        }
+    }
+
+    /**
      * Simple servlet to test JNDI 
      */
     public static class HelloWorldJndi extends HttpServlet {
@@ -238,6 +255,25 @@ public class TestTomcat extends TomcatBa
     }
 
     @Test
+    public void testSession() throws Exception {
+        Tomcat tomcat = getTomcatInstance();
+        
+        // Must have a real docBase - just use temp
+        org.apache.catalina.Context ctx = 
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
+        // You can customize the context by calling 
+        // its API
+        
+        Tomcat.addServlet(ctx, "myServlet", new HelloWorldSession());
+        ctx.addServletMapping("/", "myServlet");
+        
+        tomcat.start();
+        
+        ByteChunk res = getUrl("http://localhost:"; + getPort() + "/");
+        assertEquals("Hello world", res.toString());
+    }
+
+    @Test
     public void testLaunchTime() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         long t0 = System.currentTimeMillis();

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1162152&r1=1162151&r2=1162152&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Aug 26 16:09:44 2011
@@ -146,6 +146,10 @@
         <bug>51583</bug> (<rev>1157874</rev>, <rev>1162102</rev>): Fix
         shutdown delay in jdbc-pool. (fhanik/kkolinko)
       </add>
+      <fix>
+        <bug>51558</bug>: Don&apos;t force the use of StandardManager when 
using
+        any of the <code>Tomcat#addWebapp()</code> methods. (markt)
+      </fix>
     </changelog>
   </subsection>  
 </section>



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

Reply via email to