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 2010/11/30 12:48:42 UTC
svn commit: r1040467 - in
/sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl:
MiltonDavServlet.java resources/SlingDavResourceFactory.java
resources/SlingResourceFactory.java
Author: fmeschbe
Date: Tue Nov 30 11:48:42 2010
New Revision: 1040467
URL: http://svn.apache.org/viewvc?rev=1040467&view=rev
Log:
Use HttpServletRequest.getPathInfo as the basis to find the resource instead of the path provided to the ResourceFactory.getResource method. The path info is the actual resource path while the provided path also includes (optional) servlet context and servlet path.
Removed:
sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/resources/SlingDavResourceFactory.java
Modified:
sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/MiltonDavServlet.java
sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/resources/SlingResourceFactory.java
Modified: sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/MiltonDavServlet.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/MiltonDavServlet.java?rev=1040467&r1=1040466&r2=1040467&view=diff
==============================================================================
--- sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/MiltonDavServlet.java (original)
+++ sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/MiltonDavServlet.java Tue Nov 30 11:48:42 2010
@@ -39,7 +39,7 @@ import org.apache.sling.api.resource.Res
import org.apache.sling.auth.core.AuthenticationSupport;
import org.apache.sling.auth.core.spi.AuthenticationHandler;
import org.apache.sling.commons.mime.MimeTypeService;
-import org.apache.sling.whiteboard.fmeschbe.miltondav.impl.resources.SlingDavResourceFactory;
+import org.apache.sling.whiteboard.fmeschbe.miltondav.impl.resources.SlingResourceFactory;
import org.osgi.service.http.HttpContext;
import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;
@@ -140,10 +140,9 @@ public class MiltonDavServlet extends Ab
} else {
prefix = DEFAULT_PREFIX;
}
- SlingDavResourceFactory.setPrefix(prefix);
java.util.Properties props = new java.util.Properties();
- props.put("resource.factory.class", SlingDavResourceFactory.NAME);
+ props.put("resource.factory.class", SlingResourceFactory.NAME);
props.put("authentication.handler.classes",
SlingAuthenticationHandler.NAME);
props.put("response.handler.class", SlingResponseHandler.NAME);
Modified: sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/resources/SlingResourceFactory.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/resources/SlingResourceFactory.java?rev=1040467&r1=1040466&r2=1040467&view=diff
==============================================================================
--- sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/resources/SlingResourceFactory.java (original)
+++ sling/whiteboard/fmeschbe/milton/src/main/java/org/apache/sling/whiteboard/fmeschbe/miltondav/impl/resources/SlingResourceFactory.java Tue Nov 30 11:48:42 2010
@@ -25,6 +25,7 @@ import javax.jcr.RepositoryException;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.auth.core.AuthenticationSupport;
+import org.apache.sling.whiteboard.fmeschbe.miltondav.impl.MiltonDavServlet;
import com.bradmcevoy.http.MiltonServlet;
import com.bradmcevoy.http.Resource;
@@ -37,9 +38,13 @@ public class SlingResourceFactory implem
public SlingResourceFactory() {
}
- public Resource getResource(final String host, String path) {
+ public Resource getResource(final String host, String pathIgnored) {
- if (path.length() == 0) {
+ // use the request path info as the actual resource path
+ // the pathIgnored is prefixed with the servlet context path and
+ // the servlet path, which we cannot use here
+ String path = MiltonDavServlet.request().getPathInfo();
+ if (path == null || path.length() == 0) {
path = "/";
} else if (path.length() > 1 && path.endsWith("/")) {
path = path.substring(0, path.length() - 1);