tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1346512 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/StandardContext.java java/org/apache/tomcat/util/http/mapper/Mapper.java test/org/apache/tomcat/util/http/mapper/TestMapperContextRoot.java webapps/docs/changelog.xml
Date Tue, 05 Jun 2012 18:20:26 GMT
Author: markt
Date: Tue Jun  5 18:20:24 2012
New Revision: 1346512

URL: http://svn.apache.org/viewvc?rev=1346512&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53356
Add support for an explicit mapping of a servlet to the context root

Added:
    tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperContextRoot.java
      - copied unchanged from r1346510, tomcat/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperContextRoot.java
Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1346510

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1346512&r1=1346511&r2=1346512&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Tue Jun  5 18:20:24
2012
@@ -6082,6 +6082,9 @@ public class StandardContext extends Con
         if (urlPattern.indexOf('\n') >= 0 || urlPattern.indexOf('\r') >= 0) {
             return (false);
         }
+        if (urlPattern.equals("")) {
+            return true;
+        }
         if (urlPattern.startsWith("*.")) {
             if (urlPattern.indexOf('/') < 0) {
                 checkUnusualURLPattern(urlPattern);

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=1346512&r1=1346511&r2=1346512&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Tue Jun  5 18:20:24
2012
@@ -393,7 +393,13 @@ public final class Mapper {
                 context.defaultWrapper = newWrapper;
             } else {
                 // Exact wrapper
-                newWrapper.name = path;
+                if (path.length() == 0) {
+                    // Special case for the Context Root mapping which is
+                    // treated as an exact match
+                    newWrapper.name = "/";
+                } else {
+                    newWrapper.name = path;
+                }
                 Wrapper[] oldWrappers = context.exactWrappers;
                 Wrapper[] newWrappers =
                     new Wrapper[oldWrappers.length + 1];
@@ -1026,8 +1032,16 @@ public final class Mapper {
         int pos = find(wrappers, path);
         if ((pos != -1) && (path.equals(wrappers[pos].name))) {
             mappingData.requestPath.setString(wrappers[pos].name);
-            mappingData.wrapperPath.setString(wrappers[pos].name);
             mappingData.wrapper = wrappers[pos].object;
+            if (path.equals("/")) {
+                // Special handling for Context Root mapped servlet
+                mappingData.pathInfo.setString("/");
+                mappingData.wrapperPath.recycle();
+                // This seems wrong but it is what the spec says...
+                mappingData.contextPath.recycle();
+            } else {
+                mappingData.wrapperPath.setString(wrappers[pos].name);
+            }
         }
     }
 

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1346512&r1=1346511&r2=1346512&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Jun  5 18:20:24 2012
@@ -206,6 +206,10 @@
         <bug>53354</bug>: Correctly handle <code>@WebFilter</code>
annotations
         that do not include a mapping. (markt)
       </fix>
+      <fix>
+        <bug>53356</bug>: Add support for servlets mapped explicitly to the
+        context root of a web application. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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


Mime
View raw message