Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51136
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 4 May 2011 08:48:26 +0000 (08:48 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 4 May 2011 08:48:26 +0000 (08:48 +0000)
Provide methods that enable the name of a Context on Context creation when using Tomcat in an embedded scenario.
Based on a patch provided by David Calavera.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1099374 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/Tomcat.java
webapps/docs/changelog.xml

index 386b4e9..f3b3138 100644 (file)
@@ -459,9 +459,15 @@ public class Tomcat {
     }
 
     public Context addContext(Host host, String contextPath, String dir) {
+        return addContext(host, contextPath, contextPath, dir);
+    }
+
+    public Context addContext(Host host, String contextPath, String contextName,
+            String dir) {
         silence(contextPath);
         Context ctx = new StandardContext();
-        ctx.setPath( contextPath );
+        ctx.setName(contextName);
+        ctx.setPath(contextPath);
         ctx.setDocBase(dir);
         ctx.addLifecycleListener(new FixContextListener());
         
@@ -474,10 +480,15 @@ public class Tomcat {
     }
     
     public Context addWebapp(Host host, String url, String path) {
+        return addWebapp(host, url, url, path);
+    }
+
+    public Context addWebapp(Host host, String url, String name, String path) {
         silence(url);
 
         Context ctx = new StandardContext();
-        ctx.setPath( url );
+        ctx.setName(name);
+        ctx.setPath(url);
         ctx.setDocBase(path);
         if (defaultRealm == null) {
             initSimpleAuth();
index 82fd892..e4ed633 100644 (file)
         Add a container event that is fired when a session&apos;s ID is changed,
         e.g. on authentication. (markt)
       </add>
+      <add>
+        <bug>51136</bug>: Provide methods that enable the name of a Context on
+        Context creation when using Tomcat in an embedded scenario. Based on a
+        patch provided by David Calavera. (markt)
+      </add>
       <fix>
         <bug>51137</bug>: Add additional Microsoft Office MIME type mappings.
         (rjung)