Author: markt Date: Thu May 15 13:51:54 2008 New Revision: 656829 URL: http://svn.apache.org/viewvc?rev=656829&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44021 Add support for # to signify multi-level contexts for directories and wars.
Modified: tomcat/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=656829&r1=656828&r2=656829&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Thu May 15 13:51:54 2008 @@ -51,14 +51,6 @@ +1: jfclere, rjung, fhanik, remm, pero -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44021 - and https://issues.apache.org/bugzilla/show_bug.cgi?id=43013 - Add support for # to signify multi-level contexts for directories and - wars. - http://svn.apache.org/viewvc?rev=653549&view=rev - +1: markt, remm, fhanik - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44943 Reduce issues caused by copy/paste and different engine names http://svn.apache.org/viewvc?rev=654177&view=rev Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java?rev=656829&r1=656828&r2=656829&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java Thu May 15 13:51:54 2008 @@ -226,7 +226,7 @@ if (basename.equals("ROOT")) { path = ""; } else { - path = "/" + basename; + path = "/" + basename.replace('#', '/'); } if ((host.findChild(path) != null) && !isDeployed(path)) { Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java?rev=656829&r1=656828&r2=656829&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/manager/ManagerServlet.java Thu May 15 13:51:54 2008 @@ -1363,6 +1363,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"); @@ -1374,9 +1377,9 @@ xml.delete(); } // Perform new deployment - check(path); + check(path.replace('#', '/')); } finally { - removeServiced(path); + removeServiced(path.replace('#','/')); } } writer.println(sm.getString("managerServlet.undeployed", @@ -1408,14 +1411,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: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=656829&r1=656828&r2=656829&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java Thu May 15 13:51:54 2008 @@ -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,8 @@ 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: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=656829&r1=656828&r2=656829&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java Thu May 15 13:51:54 2008 @@ -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"); @@ -703,7 +703,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); @@ -841,6 +841,7 @@ name = path; } } + name = name.replace('/', '#'); File docBase = new File(name); if (!docBase.isAbsolute()) { docBase = new File(appBase(), name); @@ -877,7 +878,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: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=656829&r1=656828&r2=656829&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Thu May 15 13:51:54 2008 @@ -93,6 +93,10 @@ flag is set to true. This mimics the behavior of 6.0.15 and earlier. (fhanik) </update> <fix> + <bug>44021</bug>: Add support for using the # character to define + multi-level contexts in WARs and dirctories in the appBase. (markt) + </fix> + <fix> <bug>44337</bug>: Dir listing crashes if no readme-file present (funkman) </fix> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]