jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1475737 - in /jackrabbit/branches/2.4: ./ jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
Date Thu, 25 Apr 2013 12:56:17 GMT
Author: reschke
Date: Thu Apr 25 12:56:17 2013
New Revision: 1475737

URL: http://svn.apache.org/r1475737
Log:
JCR-3583: UPDATE method needs to deal with both absolute paths and absolute URIs in payloads
(ported to 2.4)

Modified:
    jackrabbit/branches/2.4/   (props changed)
    jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java

Propchange: jackrabbit/branches/2.4/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1475718

Modified: jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java?rev=1475737&r1=1475736&r2=1475737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
Thu Apr 25 12:56:17 2013
@@ -418,7 +418,8 @@ public class VersionControlledItemCollec
                 node.restoreByLabel(labels[0], removeExisting);
 
             } else if (updateInfo.getWorkspaceHref() != null) {
-                String workspaceName = getLocatorFromHref(updateInfo.getWorkspaceHref()).getWorkspaceName();
+                String href = obtainAbsolutePathFromUri(updateInfo.getWorkspaceHref());
+                String workspaceName = getLocatorFromHref(href).getWorkspaceName();
                 node.update(workspaceName);
             } else {
                 throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid update
request body.");
@@ -674,4 +675,20 @@ public class VersionControlledItemCollec
     private VersionManager getVersionManager() throws RepositoryException {
         return getRepositorySession().getWorkspace().getVersionManager();
     }
+
+    private static String obtainAbsolutePathFromUri(String uri) {
+        try {
+            java.net.URI u = new java.net.URI(uri);
+            StringBuilder sb = new StringBuilder();
+            sb.append(u.getRawPath());
+            if (u.getRawQuery() != null) {
+                sb.append("?" + u.getRawQuery());
+            }
+            return sb.toString();
+        }
+        catch (java.net.URISyntaxException ex) {
+            log.warn("parsing " + uri, ex);
+            return uri;
+        }
+    }
 }



Mime
View raw message