From: markt Date: Wed, 4 May 2011 08:48:26 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51136 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=22b59af11468d1c0696686d6764fd50b3a55ed0d;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51136 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 --- diff --git a/java/org/apache/catalina/startup/Tomcat.java b/java/org/apache/catalina/startup/Tomcat.java index 386b4e9fd..f3b31389a 100644 --- a/java/org/apache/catalina/startup/Tomcat.java +++ b/java/org/apache/catalina/startup/Tomcat.java @@ -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(); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 82fd89227..e4ed633c5 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -94,6 +94,11 @@ Add a container event that is fired when a session's ID is changed, e.g. on authentication. (markt) + + 51136: 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) + 51137: Add additional Microsoft Office MIME type mappings. (rjung)