felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kgil...@apache.org
Subject svn commit: r1228772 - /felix/trunk/httplite/minimum/src/main/java/org/apache/felix/httplite/server/ResourceHandler.java
Date Sun, 08 Jan 2012 03:32:26 GMT
Author: kgilmer
Date: Sun Jan  8 03:32:25 2012
New Revision: 1228772

URL: http://svn.apache.org/viewvc?rev=1228772&view=rev
Log:
httplite: fix resource path creation.  Remove redundant path separator char.

Modified:
    felix/trunk/httplite/minimum/src/main/java/org/apache/felix/httplite/server/ResourceHandler.java

Modified: felix/trunk/httplite/minimum/src/main/java/org/apache/felix/httplite/server/ResourceHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/httplite/minimum/src/main/java/org/apache/felix/httplite/server/ResourceHandler.java?rev=1228772&r1=1228771&r2=1228772&view=diff
==============================================================================
--- felix/trunk/httplite/minimum/src/main/java/org/apache/felix/httplite/server/ResourceHandler.java
(original)
+++ felix/trunk/httplite/minimum/src/main/java/org/apache/felix/httplite/server/ResourceHandler.java
Sun Jan  8 03:32:25 2012
@@ -49,6 +49,7 @@ public class ResourceHandler implements 
     private final String m_name;
     private final String m_alias;
 	private final Logger m_logger;
+    private final int m_aliasIndex;
 
     /**
      * @param req HttpRequest
@@ -69,6 +70,7 @@ public class ResourceHandler implements 
         this.m_httpContext = resource.getContext();
         this.m_name = resource.getName();
         this.m_alias = resource.getAlias();  
+        this.m_aliasIndex = m_alias.length() + 1;
         this.m_logger = logger;
     }
 
@@ -122,6 +124,13 @@ public class ResourceHandler implements 
      */
     private String getResourceName(final String path)
     {
-        return m_name + "/" + path.substring(m_alias.length());
+        //Ensure that the path begins at root.
+        String rpath = path;
+        if (!path.startsWith( "/" ))
+        {
+            rpath = "/" + path;
+        }
+        
+        return m_name + "/" + rpath.substring(m_aliasIndex);
     }
 }



Mime
View raw message