You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Jon Stevens <jo...@latchkey.com> on 2001/10/01 00:12:44 UTC

Extension Mapping in Turbine

Finally, we will have easier/smaller/cleaner URI's in Turbine. This is
something people have been asking for for years now.

I have confirmed extension mapping working in Turbine with this patch to
Catalina. There are some patches required of Turbine as well, but at least I
can get it working now for certain.

I will check in the patches to Turbine once I can confirm 100% that they do
not break backwards compatibility. The issue remaining to be resolved is
that the DynamicURI/LinkTool needs to not append "template/Foo" to the path
if it doesn't need to.

Thanks,

-jon

------ Forwarded Message
From: bugzilla@apache.org
Reply-To: tomcat-dev@jakarta.apache.org
Date: 30 Sep 2001 22:07:56 -0000
To: tomcat-dev@jakarta.apache.org
Subject: DO NOT REPLY [Bug 3890] New:  -  path_info is not kept when using
servlet extension mapping

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;
                 }
             }
         }

------ End of Forwarded Message


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