jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1475718 - /jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
Date Thu, 25 Apr 2013 12:03:54 GMT
Author: reschke
Date: Thu Apr 25 12:03:53 2013
New Revision: 1475718

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

Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java?rev=1475718&r1=1475717&r2=1475718&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
Thu Apr 25 12:03:53 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