Author: dkuleshov
Date: 2011-03-02 05:08:09 -0500 (Wed, 02 Mar 2011)
New Revision: 4040
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MoveCommand.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestCopy.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestMove.java
Log:
EXOJCR-1217: small fixes
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2011-03-02
08:47:58 UTC (rev 4039)
+++
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2011-03-02
10:08:09 UTC (rev 4040)
@@ -522,7 +522,8 @@
if (session.getRootNode().hasNode(TextUtil.relativizePath(repoPath)))
{
- return Response.status(HTTPStatus.PRECON_FAILED).entity("Not
Found").build();
+ return Response.status(HTTPStatus.PRECON_FAILED)
+ .entity("Item exists on destination path, while overwriting is
forbidden").build();
}
}
@@ -932,7 +933,8 @@
Response prpfind = new PropFindCommand().propfind(session, destNodePath,
body, depth.getIntValue(), uri);
if (prpfind.getStatus() != HTTPStatus.NOT_FOUND)
{
- return
Response.status(HTTPStatus.PRECON_FAILED).entity("Preconditions
Failed").build();
+ return Response.status(HTTPStatus.PRECON_FAILED)
+ .entity("Item exists on destination path, while overwriting is
forbidden").build();
}
}
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MoveCommand.java
===================================================================
---
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MoveCommand.java 2011-03-02
08:47:58 UTC (rev 4039)
+++
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MoveCommand.java 2011-03-02
10:08:09 UTC (rev 4040)
@@ -162,8 +162,26 @@
sourceSession.getItem(srcPath).remove();
sourceSession.save();
- return
Response.status(HTTPStatus.NO_CONTENT).cacheControl(cacheControl).build();
+ // If the source resource was successfully moved
+ // to a pre-existing destination resource.
+ if (itemExisted)
+ {
+ return
Response.status(HTTPStatus.NO_CONTENT).cacheControl(cacheControl).build();
+ }
+ // If the source resource was successfully moved,
+ // and a new resource was created at the destination.
+ else
+ {
+ if (uriBuilder != null)
+ {
+ return
Response.created(uriBuilder.path(destSession.getWorkspace().getName()).path(destPath).build())
+ .cacheControl(cacheControl).build();
+ }
+ // to save compatibility if uriBuilder is not provided
+ return
Response.status(HTTPStatus.CREATED).cacheControl(cacheControl).build();
+ }
+
}
catch (LockException exc)
{
Modified:
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestCopy.java
===================================================================
---
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestCopy.java 2011-03-02
08:47:58 UTC (rev 4039)
+++
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestCopy.java 2011-03-02
10:08:09 UTC (rev 4040)
@@ -41,7 +41,7 @@
public class TestCopy extends BaseStandaloneTest
{
- static final String host = "http://localhost:8080";
+ final static private String host = "http://localhost:8080";
public void testeCopyForNonCollectionSingleWorkSpace() throws Exception
{
Modified:
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestMove.java
===================================================================
---
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestMove.java 2011-03-02
08:47:58 UTC (rev 4039)
+++
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestMove.java 2011-03-02
10:08:09 UTC (rev 4040)
@@ -40,7 +40,7 @@
*/
public class TestMove extends BaseStandaloneTest
{
- final static String host = "http://localhost:8080";
+ final static private String host = "http://localhost:8080";
public void testMoveForNonCollectionSingleWorkspace() throws Exception
{
Show replies by date