jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1470573 - /jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
Date Mon, 22 Apr 2013 15:14:44 GMT
Author: reschke
Date: Mon Apr 22 15:14:33 2013
New Revision: 1470573

URL: http://svn.apache.org/r1470573
Log:
JCR-3578: use absolute paths in DeltaV request bodies, and resolve hrefs in responses properly

Modified:
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=1470573&r1=1470572&r2=1470573&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
Mon Apr 22 15:14:33 2013
@@ -1786,8 +1786,9 @@ public class RepositoryServiceImpl imple
     private void update(String uri, Path relPath, String[] updateSource, int updateType,
boolean removeExisting, SessionInfo sessionInfo) throws RepositoryException {
         try {
             UpdateInfo uInfo;
+            String tmpUpdateSource[] = obtainAbsolutePathsFromUris(updateSource);
             if (removeExisting || relPath != null) {
-                Element uElem = UpdateInfo.createUpdateElement(updateSource, updateType,
DomUtil.createDocument());
+                Element uElem = UpdateInfo.createUpdateElement(tmpUpdateSource, updateType,
DomUtil.createDocument());
                 if (removeExisting) {
                     DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_REMOVEEXISTING,
ItemResourceConstants.NAMESPACE);
                 }
@@ -1797,10 +1798,6 @@ public class RepositoryServiceImpl imple
 
                 uInfo = new UpdateInfo(uElem);
             } else {
-                String tmpUpdateSource[] = new String[updateSource.length];
-                for (int i = 0; i < updateSource.length; i++) {
-                    tmpUpdateSource[i] = obtainAbsolutePathFromUri(updateSource[i]);
-                }
                 uInfo = new UpdateInfo(tmpUpdateSource, updateType, new DavPropertyNameSet());
             }
 
@@ -1828,20 +1825,21 @@ public class RepositoryServiceImpl imple
     public Iterator<NodeId> merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName,
boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException,
MergeException, LockException, InvalidItemStateException, RepositoryException {
         try {
             Document doc = DomUtil.createDocument();
-            String wspHref = uriResolver.getWorkspaceUri(srcWorkspaceName);
-            Element mElem = MergeInfo.createMergeElement(new String[] {wspHref}, !bestEffort,
false, doc);
+            String wspHref = obtainAbsolutePathFromUri(uriResolver.getWorkspaceUri(srcWorkspaceName));
+            Element mElem = MergeInfo.createMergeElement(new String[] { wspHref }, !bestEffort,
false, doc);
             if (isShallow) {
                 mElem.appendChild(DomUtil.depthToXml(false, doc));
             }
             MergeInfo mInfo = new MergeInfo(mElem);
 
-            MergeMethod method = new MergeMethod(getItemUri(nodeId, sessionInfo), mInfo);
+            String uri = getItemUri(nodeId, sessionInfo);
+            MergeMethod method = new MergeMethod(uri, mInfo);
             execute(method, sessionInfo);
 
             MultiStatusResponse[] resps = method.getResponseBodyAsMultiStatus().getResponses();
             List<NodeId> failedIds = new ArrayList<NodeId>(resps.length);
             for (MultiStatusResponse resp : resps) {
-                String href = resp.getHref();
+                String href = resolve(uri, resp.getHref());
                 failedIds.add(uriResolver.getNodeId(href, sessionInfo));
             }
             return failedIds.iterator();
@@ -2834,7 +2832,20 @@ public class RepositoryServiceImpl imple
             return uri;
         }
     }
-    
+
+    private static String[] obtainAbsolutePathsFromUris(String[] uris) {
+        if (uris == null) {
+            return null;
+        } else {
+            String result[] = new String[uris.length];
+
+            for (int i = 0; i < result.length; i++) {
+                result[i] = obtainAbsolutePathFromUri(uris[i]);
+            }
+            return result;
+        }
+    }
+
     /**
      * The XML elements and attributes used in serialization
      */



Mime
View raw message