Author: jfrederic.clere(a)jboss.com
Date: 2008-07-25 12:14:15 -0400 (Fri, 25 Jul 2008)
New Revision: 729
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/manager/HTMLManagerServlet.java
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/manager/ManagerServlet.java
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/startup/ContextConfig.java
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/startup/HostConfig.java
Log:
Fix minor possible 2008-XXX.
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/manager/HTMLManagerServlet.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/manager/HTMLManagerServlet.java 2008-07-25
13:48:38 UTC (rev 728)
+++
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/manager/HTMLManagerServlet.java 2008-07-25
16:14:15 UTC (rev 729)
@@ -202,7 +202,7 @@
if (basename.equals("ROOT")) {
path = "";
} else {
- path = "/" + basename;
+ path = "/" + basename.replace('#', '/');
}
if (!isServiced(path)) {
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/manager/ManagerServlet.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/manager/ManagerServlet.java 2008-07-25
13:48:38 UTC (rev 728)
+++
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/manager/ManagerServlet.java 2008-07-25
16:14:15 UTC (rev 729)
@@ -1293,6 +1293,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");
@@ -1304,9 +1307,9 @@
xml.delete();
}
// Perform new deployment
- check(path);
+ check(path.replace('#', '/'));
} finally {
- removeServiced(path);
+ removeServiced(path.replace('#','/'));
}
}
writer.println(sm.getString("managerServlet.undeployed",
@@ -1338,14 +1341,14 @@
/**
- * Given a context path, get the config file name.
+ * Given a context path, get the doc base.
*/
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:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/startup/ContextConfig.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/startup/ContextConfig.java 2008-07-25
13:48:38 UTC (rev 728)
+++
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/startup/ContextConfig.java 2008-07-25
16:14:15 UTC (rev 729)
@@ -881,12 +881,16 @@
file = new File(docBase);
String origDocBase = docBase;
+ 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() +
"!/");
- String contextPath = context.getPath();
- if (contextPath.equals("")) {
- contextPath = "ROOT";
- }
+ URL war = new URL("jar:" + (new File(docBase)).toURI().toURL() +
"!/");
docBase = ExpandWar.expand(host, war, contextPath);
file = new File(docBase);
docBase = file.getCanonicalPath();
@@ -899,8 +903,9 @@
File warFile = new File(docBase + ".war");
if (warFile.exists()) {
if (unpackWARs) {
- URL war = new URL("jar:" + warFile.toURL() +
"!/");
- docBase = ExpandWar.expand(host, war, context.getPath());
+ URL war =
+ new URL("jar:" + warFile.toURI().toURL() +
"!/");
+ docBase = ExpandWar.expand(host, war, contextPath);
file = new File(docBase);
docBase = file.getCanonicalPath();
} else {
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/startup/HostConfig.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/startup/HostConfig.java 2008-07-25
13:48:38 UTC (rev 728)
+++
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/startup/HostConfig.java 2008-07-25
16:14:15 UTC (rev 729)
@@ -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")) {
// 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 = "";