jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1466060 - in /jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav: AbstractLocatorFactory.java WebdavRequestImpl.java
Date Tue, 09 Apr 2013 14:50:18 GMT
Author: reschke
Date: Tue Apr  9 14:50:18 2013
New Revision: 1466060

URL: http://svn.apache.org/r1466060
Log:
JCR-3565: AbstractLocatorFactory.createResourceLocator needs to be called with an absolute
URI as prefix

Modified:
    jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java
    jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java?rev=1466060&r1=1466059&r2=1466060&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java
Tue Apr  9 14:50:18 2013
@@ -88,6 +88,10 @@ public abstract class AbstractLocatorFac
             throw new IllegalArgumentException("Request handle must not be null.");
         }
 
+        if (prefix == null || prefix.length() == 0) {
+            throw new IllegalArgumentException("Prefix must be an absolute URI.");
+        }
+
         // build prefix string and remove all prefixes from the given href.
         StringBuffer b = new StringBuffer("");
         if (prefix != null && prefix.length() > 0) {

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java?rev=1466060&r1=1466059&r2=1466060&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
Tue Apr  9 14:50:18 2013
@@ -88,6 +88,7 @@ public class WebdavRequestImpl implement
     private final DavLocatorFactory factory;
     private final IfHeader ifHeader;
     private final String hrefPrefix;
+    private final String uriPrefix;
 
     private DavSession session;
 
@@ -115,13 +116,10 @@ public class WebdavRequestImpl implement
         this.factory = factory;
         this.ifHeader = new IfHeader(httpRequest);
 
-        if (createAbsoluteURI)  {
-            String host = getHeader("Host");
-            String scheme = getScheme();
-            hrefPrefix = scheme + "://" + host + getContextPath();
-        } else {
-            hrefPrefix = getContextPath();
-        }
+        String host = getHeader("Host");
+        String scheme = getScheme();
+        this.uriPrefix = scheme + "://" + host + getContextPath();
+        this.hrefPrefix = createAbsoluteURI ? this.uriPrefix : getContextPath();
     }
 
     /**
@@ -167,7 +165,7 @@ public class WebdavRequestImpl implement
         if (path.startsWith(ctx)) {
             path = path.substring(ctx.length());
         }
-        return factory.createResourceLocator(hrefPrefix, path);
+        return factory.createResourceLocator(uriPrefix, path);
     }
 
     /**



Mime
View raw message