Author: remy.maucherat(a)jboss.com
Date: 2008-05-05 19:46:23 -0400 (Mon, 05 May 2008)
New Revision: 610
Modified:
trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java
trunk/java/org/apache/catalina/manager/ManagerServlet.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/java/org/apache/catalina/startup/HostConfig.java
trunk/webapps/docs/changelog.xml
Log:
- Port fairly complex Tomcat patch adding multi level support to the deployer and
manager.
Modified: trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java 2008-05-05 09:47:45 UTC
(rev 609)
+++ trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java 2008-05-05 23:46:23 UTC
(rev 610)
@@ -226,7 +226,7 @@
if (basename.equals("ROOT")) {
path = "";
} else {
- path = "/" + basename;
+ path = "/" + basename.replace('#', '/');
}
if ((host.findChild(path) != null) && !isDeployed(path)) {
Modified: trunk/java/org/apache/catalina/manager/ManagerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/manager/ManagerServlet.java 2008-05-05 09:47:45 UTC
(rev 609)
+++ trunk/java/org/apache/catalina/manager/ManagerServlet.java 2008-05-05 23:46:23 UTC
(rev 610)
@@ -1306,6 +1306,9 @@
// Ignore
}
try {
+ if (path.lastIndexOf('/') > 0) {
+ path = "/" +
path.substring(1).replace('/','#');
+ }
File war = new File(getAppBase(), getDocBase(path) +
".war");
File dir = new File(getAppBase(), getDocBase(path));
File xml = new File(configBase, getConfigFile(path) +
".xml");
@@ -1317,9 +1320,9 @@
xml.delete();
}
// Perform new deployment
- check(path);
+ check(path.replace('#','/'));
} finally {
- removeServiced(path);
+ removeServiced(path.replace('#','/'));
}
}
writer.println(sm.getString("managerServlet.undeployed",
@@ -1351,14 +1354,14 @@
/**
- * Given a context path, get the config file name.
+ * Given a context path, get the doc abse.
*/
protected String getDocBase(String path) {
String basename = null;
if (path.equals("")) {
basename = "ROOT";
} else {
- basename = path.substring(1);
+ basename = path.substring(1).replace('/', '#');
}
return (basename);
}
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2008-05-05 09:47:45 UTC (rev
609)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2008-05-05 23:46:23 UTC (rev
610)
@@ -873,9 +873,13 @@
String contextPath = context.getPath();
if (contextPath.equals("")) {
contextPath = "ROOT";
+ } else {
+ if (contextPath.lastIndexOf('/') > 0) {
+ contextPath = "/" +
contextPath.substring(1).replace('/','#');
+ }
}
if (docBase.toLowerCase().endsWith(".war") &&
!file.isDirectory() && unpackWARs) {
- URL war = new URL("jar:" + (new File(docBase)).toURL() +
"!/");
+ URL war = new URL("jar:" + (new File(docBase)).toURI().toURL() +
"!/");
docBase = ExpandWar.expand(host, war, contextPath);
file = new File(docBase);
docBase = file.getCanonicalPath();
@@ -888,7 +892,7 @@
File warFile = new File(docBase + ".war");
if (warFile.exists()) {
if (unpackWARs) {
- URL war = new URL("jar:" + warFile.toURL() +
"!/");
+ URL war = new URL("jar:" + warFile.toURI().toURL() +
"!/");
docBase = ExpandWar.expand(host, war, contextPath);
file = new File(docBase);
docBase = file.getCanonicalPath();
Modified: trunk/java/org/apache/catalina/startup/HostConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/HostConfig.java 2008-05-05 09:47:45 UTC (rev
609)
+++ trunk/java/org/apache/catalina/startup/HostConfig.java 2008-05-05 23:46:23 UTC (rev
610)
@@ -463,14 +463,14 @@
/**
- * Given a context path, get the config file name.
+ * Given a context path, get the docBase.
*/
protected String getDocBase(String path) {
String basename = null;
if (path.equals("")) {
basename = "ROOT";
} else {
- basename = path.substring(1);
+ basename = path.substring(1).replace('/', '#');
}
return (basename);
}
@@ -503,7 +503,7 @@
File appBase = appBase();
File configBase = configBase();
String baseName = getConfigFile(name);
- String docBase = getConfigFile(name);
+ String docBase = getDocBase(name);
// Deploy XML descriptors from configBase
File xml = new File(configBase, baseName + ".xml");
@@ -699,7 +699,7 @@
if (files[i].toLowerCase().endsWith(".war") &&
dir.isFile()) {
// Calculate the context path and make sure it is unique
- String contextPath = "/" + files[i];
+ String contextPath = "/" +
files[i].replace('#','/');
int period = contextPath.lastIndexOf(".");
if (period >= 0)
contextPath = contextPath.substring(0, period);
@@ -837,6 +837,7 @@
name = path;
}
}
+ name = name.replace('/', '#');
File docBase = new File(name);
if (!docBase.isAbsolute()) {
docBase = new File(appBase(), name);
@@ -873,7 +874,7 @@
if (dir.isDirectory()) {
// Calculate the context path and make sure it is unique
- String contextPath = "/" + files[i];
+ String contextPath = "/" +
files[i].replace('#','/');
if (files[i].equals("ROOT"))
contextPath = "";
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-05-05 09:47:45 UTC (rev 609)
+++ trunk/webapps/docs/changelog.xml 2008-05-05 23:46:23 UTC (rev 610)
@@ -52,6 +52,9 @@
<bug>43079</bug> and <bug>43080</bug>: Move odd
url-pattern warning to StandardContext so a) we catch all patterns
and b) it isn't logged to the wrong webapp. Based on a patch by John Kew.
(markt)
</fix>
+ <fix>
+ <bug>44021</bug>: Add support to manger and deployer for wars and
dirs that use # to denote multi-level contexts. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">