jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1466129 - in /jackrabbit/branches/2.6: ./ jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
Date Tue, 09 Apr 2013 16:57:45 GMT
Author: reschke
Date: Tue Apr  9 16:57:45 2013
New Revision: 1466129

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

Modified:
    jackrabbit/branches/2.6/   (props changed)
    jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java
    jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java

Propchange: jackrabbit/branches/2.6/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1466060,1466085

Modified: jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java?rev=1466129&r1=1466128&r2=1466129&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/AbstractLocatorFactory.java
Tue Apr  9 16:57:45 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/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java?rev=1466129&r1=1466128&r2=1466129&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
Tue Apr  9 16:57:45 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);
     }
 
     /**
@@ -223,7 +221,7 @@ public class WebdavRequestImpl implement
                 throw new DavException(DavServletResponse.SC_FORBIDDEN);
             }
         }
-        return factory.createResourceLocator(hrefPrefix, ref);
+        return factory.createResourceLocator(uriPrefix, ref);
     }
 
     /**
@@ -233,7 +231,7 @@ public class WebdavRequestImpl implement
      */
     public DavResourceLocator getMemberLocator(String segment) {
         String path = (this.getRequestLocator().getHref(true) + segment).substring(hrefPrefix.length());
-        return factory.createResourceLocator(hrefPrefix, path);
+        return factory.createResourceLocator(uriPrefix, path);
     }
 
     /**



Mime
View raw message