You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2011/10/14 04:49:31 UTC

svn commit: r1183210 - /geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java

Author: xuhaihong
Date: Fri Oct 14 02:49:31 2011
New Revision: 1183210

URL: http://svn.apache.org/viewvc?rev=1183210&view=rev
Log:
GERONIMO-6171
a. Comment out the codes for adding default context.
b. Use "" for the root context path

Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=1183210&r1=1183209&r2=1183210&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java Fri Oct 14 02:49:31 2011
@@ -143,7 +143,7 @@ public class TomcatContainer implements 
             // the default Realm if you are using container-managed security.
 
             //Add default contexts
-            File rootContext = new File(catalinaHome + "/ROOT");
+            /*File rootContext = new File(catalinaHome + "/ROOT");
 
             String docBase = "";
             if (rootContext.exists()) {
@@ -170,7 +170,7 @@ public class TomcatContainer implements 
                     ctx.setInstanceManager(new TomcatInstanceManager(new Holder(), classLoader, null));
                 }
                 host.addChild(defaultContext);
-            }
+            }*/
 
             // 6. Call addEngine() to attach this Engine to the set of defined
             // Engines for this object.
@@ -191,13 +191,13 @@ public class TomcatContainer implements 
 
             //10. Set InstanceManager for each default Context
             //The reason for placing the codes here (not in the step 2 ) is NPE is get while invoking the getServletContext method
-            for (Container host : hosts) {
+            /*for (Container host : hosts) {
                 Container container = host.findChild("");
                 if (container instanceof GeronimoStandardContext) {
                     GeronimoStandardContext ctx = (GeronimoStandardContext) container;
                     ctx.getServletContext().setAttribute(InstanceManager.class.getName(), ctx.getInstanceManager());
                 }
-            }
+            }*/
         }
         this.objectName = objectName;
         this.applicationListeners = applicationListeners;
@@ -266,7 +266,8 @@ public class TomcatContainer implements 
      * @see org.apache.catalina.Host
      */
     public void addContext(TomcatContext contextInfo) throws Exception {
-        Context context = createContext(contextInfo.getContextPath(), contextInfo.getClassLoader(), contextInfo.getWebAppInfo());
+        //Tomcat internally use empty string to represent the root context        
+        Context context = createContext(contextInfo.getContextPath().equals("/") ? "" : contextInfo.getContextPath(), contextInfo.getClassLoader(), contextInfo.getWebAppInfo());
         //Was a virtual server defined?
         String virtualServer = contextInfo.getVirtualServer();
         if (virtualServer == null) {