You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/01/15 12:45:15 UTC

svn commit: r612090 - /incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/PathSupport.java

Author: fmeschbe
Date: Tue Jan 15 03:45:13 2008
New Revision: 612090

URL: http://svn.apache.org/viewvc?rev=612090&view=rev
Log:
Don't use search path if the relpath is already absolute

Modified:
    incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/PathSupport.java

Modified: incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/PathSupport.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/PathSupport.java?rev=612090&r1=612089&r2=612090&view=diff
==============================================================================
--- incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/PathSupport.java (original)
+++ incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/PathSupport.java Tue Jan 15 03:45:13 2008
@@ -62,6 +62,9 @@
     }
 
     private static class ScriptPathIterator implements Iterator<String> {
+        
+        private static final String[] EMPTY_PATH = { "" };
+        
         private final String resourceTypePath;
 
         private final String selectorsPath;
@@ -88,7 +91,7 @@
             }
 
             // path prefixes
-            this.path = path;
+            this.path = resourceTypePath.startsWith("/") ? EMPTY_PATH : path;
             this.pathIdx = -1;
 
             // prepare the first entry
@@ -102,7 +105,7 @@
             this.selectorsPath = null;
 
             // path prefixes
-            this.path = path;
+            this.path = resourceTypePath.startsWith("/") ? EMPTY_PATH : path;
             this.pathIdx = -1;
 
             // prepare the first entry
@@ -142,7 +145,7 @@
                     final StringBuffer sb = new StringBuffer();
 
                     // the default path root
-                    sb.append(path[pathIdx]).append('/');
+                    sb.append(path[pathIdx]);
 
                     // append the resource type derived path
                     sb.append(resourceTypePath);