ASF Bugzilla – Attachment 21230 Details for
Bug 44021
Deployer cannot deploy wars with #s
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to resolve this bug / issue
sub-context-patch.txt (text/plain), 4.94 KB, created by
Eric Benzacar
on 2007-12-04 15:55:14 UTC
(
hide
)
Description:
Patch to resolve this bug / issue
Filename:
MIME Type:
Creator:
Eric Benzacar
Created:
2007-12-04 15:55:14 UTC
Size:
4.94 KB
patch
obsolete
>diff -r -u apache-tomcat-6.0.14-src-orig\java\org\apache\catalina\manager\ManagerServlet.java apache-tomcat-6.0.14-src\java\org\apache\catalina\manager\ManagerServlet.java >--- apache-tomcat-6.0.14-src-orig\java\org\apache\catalina\manager\ManagerServlet.java Fri Jul 20 04:20:32 2007 >+++ apache-tomcat-6.0.14-src\java\org\apache\catalina\manager\ManagerServlet.java Tue Dec 04 18:21:23 2007 >@@ -1353,7 +1353,7 @@ > // Ignore > } > try { >- File war = new File(getAppBase(), getDocBase(path) + ".war"); >+ File war = new File(getAppBase(), getDocBase(path).replace( "/", "#" ) + ".war"); > File dir = new File(getAppBase(), getDocBase(path)); > File xml = new File(configBase, getConfigFile(path) + ".xml"); > if (war.exists()) { >diff -r -u apache-tomcat-6.0.14-src-orig\java\org\apache\catalina\startup\ContextConfig.java apache-tomcat-6.0.14-src\java\org\apache\catalina\startup\ContextConfig.java >--- apache-tomcat-6.0.14-src-orig\java\org\apache\catalina\startup\ContextConfig.java Fri Jul 20 04:20:32 2007 >+++ apache-tomcat-6.0.14-src\java\org\apache\catalina\startup\ContextConfig.java Tue Dec 04 16:12:24 2007 >@@ -881,12 +881,12 @@ > file = new File(docBase); > String origDocBase = docBase; > >- String contextPath = context.getPath(); >+ String contextPath = context.getPath().replace( '#', '/' ); > if (contextPath.equals("")) { > contextPath = "ROOT"; > } > 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(); >diff -r -u apache-tomcat-6.0.14-src-orig\java\org\apache\catalina\startup\ExpandWar.java apache-tomcat-6.0.14-src\java\org\apache\catalina\startup\ExpandWar.java >--- apache-tomcat-6.0.14-src-orig\java\org\apache\catalina\startup\ExpandWar.java Fri Jul 20 04:20:32 2007 >+++ apache-tomcat-6.0.14-src\java\org\apache\catalina\startup\ExpandWar.java Tue Dec 04 15:02:35 2007 >@@ -130,7 +130,7 @@ > } > > // Create the new document base directory >- docBase.mkdir(); >+ docBase.mkdirs(); > > // Expand the WAR into the new document base directory > JarURLConnection juc = (JarURLConnection) war.openConnection(); >diff -r -u apache-tomcat-6.0.14-src-orig\java\org\apache\catalina\startup\HostConfig.java apache-tomcat-6.0.14-src\java\org\apache\catalina\startup\HostConfig.java >--- apache-tomcat-6.0.14-src-orig\java\org\apache\catalina\startup\HostConfig.java Fri Jul 20 04:20:34 2007 >+++ apache-tomcat-6.0.14-src\java\org\apache\catalina\startup\HostConfig.java Tue Dec 04 17:51:18 2007 >@@ -477,6 +477,21 @@ > > > /** >+ * Given an application name, get the context path >+ */ >+ protected String getContextPath(String appName) { >+ String contextPath = null; >+ if (appName.equals("")) { >+ contextPath = "/"; >+ } else { >+ contextPath = appName.replace('#', '/'); >+ } >+ return (contextPath); >+ } >+ >+ >+ >+ /** > * Deploy applications for any directories or WAR files that are found > * in our "application root" directory. > */ >@@ -504,19 +519,20 @@ > File configBase = configBase(); > String baseName = getConfigFile(name); > String docBase = getConfigFile(name); >+ String contextPath = getContextPath(name); > > // Deploy XML descriptors from configBase > File xml = new File(configBase, baseName + ".xml"); > if (xml.exists()) >- deployDescriptor(name, xml, baseName + ".xml"); >+ deployDescriptor(contextPath, xml, baseName + ".xml"); > // Deploy WARs, and loop if additional descriptors are found > File war = new File(appBase, docBase + ".war"); > if (war.exists()) >- deployWAR(name, war, docBase + ".war"); >+ deployWAR( contextPath, war, docBase + ".war"); > // Deploy expanded folders > File dir = new File(appBase, docBase); > if (dir.exists()) >- deployDirectory(name, dir, docBase); >+ deployDirectory(contextPath, dir, docBase); > > } > >@@ -699,7 +715,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);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 44021
: 21230