tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r653549 - in /tomcat/trunk/java/org/apache/catalina: manager/HTMLManagerServlet.java manager/ManagerServlet.java startup/ContextConfig.java startup/HostConfig.java
Date Mon, 05 May 2008 18:18:00 GMT
Author: markt
Date: Mon May  5 11:18:00 2008
New Revision: 653549

URL: http://svn.apache.org/viewvc?rev=653549&view=rev
Log:
Fix bugs https://issues.apache.org/bugzilla/show_bug.cgi?id=43013 and https://issues.apache.org/bugzilla/show_bug.cgi?id=44021
Add support to manger and deployer for wars and dirs that use # to denote multi-level contexts.

Modified:
    tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java?rev=653549&r1=653548&r2=653549&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java Mon May  5 11:18:00
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/trunk/java/org/apache/catalina/manager/ManagerServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java?rev=653549&r1=653548&r2=653549&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java Mon May  5 11:18:00
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/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=653549&r1=653548&r2=653549&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Mon May  5 11:18:00 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/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=653549&r1=653548&r2=653549&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Mon May  5 11:18:00 2008
@@ -464,14 +464,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);
     }
@@ -504,7 +504,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");
@@ -705,7 +705,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);
@@ -843,6 +843,7 @@
                         name = path;
                     }
                 }
+                name = name.replace('/', '#');
                 File docBase = new File(name);
                 if (!docBase.isAbsolute()) {
                     docBase = new File(appBase(), name);
@@ -879,7 +880,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 = "";
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message