[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-dev
Subject:    DO NOT REPLY [Bug 3890] New:  -
From:       bugzilla () apache ! org
Date:       2001-09-30 22:07:56
[Download RAW message or body]

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3890>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3890

path_info is not kept when using servlet extension mapping

           Summary: path_info is not kept when using servlet extension
                    mapping
           Product: Tomcat 4
           Version: 4.0 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: jon@latchkey.com


This patch fixes the problem.

Index: StandardContextMapper.java
=========================================================
==========
RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/co
re/StandardContextMapper.java,v
retrieving revision 1.6
diff -u -r1.6 StandardContextMapper.java
--- StandardContextMapper.java  2001/07/22 20:25:08     1.6
+++ StandardContextMapper.java  2001/09/30 22:04:35
@@ -259,19 +259,26 @@
         if (wrapper == null) {
             if (debug >= 2)
                 context.log("  Trying extension match");
-            int slash = relativeURI.lastIndexOf('/');
-            if (slash >= 0) {
-                String last = relativeURI.substring(slash);
-                int period = last.lastIndexOf('.');
-                if (period >= 0) {
-                    String pattern = "*" + last.substring(period);
-                    name = context.findServletMapping(pattern);
-                    if (name != null)
-                        wrapper = (Wrapper) context.findChild(name);
-                    if (wrapper != null) {
-                        servletPath = relativeURI;
+            int dot = relativeURI.indexOf('.');
+            String dotToEnd = relativeURI.substring(dot);
+            StringBuffer sb = new StringBuffer();
+            for (int i=1; i<dotToEnd.length(); i++) {
+                sb.append(dotToEnd.charAt(i));
+                String pattern = "*." + sb.toString();
+                name = context.findServletMapping(pattern);
+                if (name != null) {
+                    wrapper = (Wrapper) context.findChild(name);
+                }
+                if (wrapper != null) {
+                    int pathInfoStart = dot + i + 1;
+                    servletPath = relativeURI.substring(0,pathInfoStart);
+                    if (pathInfoStart < relativeURI.length()) {
+                        pathInfo = relativeURI.substring(pathInfoStart);
+                    } else {
                         pathInfo = null;
                     }
+                    update = true;
+                    break;
                 }
             }
         }

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic