From 899af82bc6b19fd06bfe3c79d057d3784b96ed13 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Thu, 22 Mar 2012 16:47:04 +0000 Subject: [PATCH] WebDAV: Minor change to expose whether the resource that was PUT was created or overwritten. This is useful for downstream changes in Thor. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34699 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/webdav/PutMethod.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source/java/org/alfresco/repo/webdav/PutMethod.java b/source/java/org/alfresco/repo/webdav/PutMethod.java index a3d5425a12..183c7707bb 100644 --- a/source/java/org/alfresco/repo/webdav/PutMethod.java +++ b/source/java/org/alfresco/repo/webdav/PutMethod.java @@ -45,11 +45,11 @@ public class PutMethod extends WebDAVMethod // Request parameters private String m_strContentType = null; private boolean m_expectHeaderPresent = false; - // Indicates if a zero byte node was created by a LOCK call. // Try to delete the node if the PUT fails private boolean noContent = false; - + private boolean created = false; + /** * Default constructor */ @@ -150,7 +150,6 @@ public class PutMethod extends WebDAVMethod // Get the status for the request path FileInfo contentNodeInfo = null; - boolean created = false; try { contentNodeInfo = getDAVHelper().getNodeForPath(getRootNodeRef(), getPath(), getServletPath()); @@ -266,4 +265,16 @@ public class PutMethod extends WebDAVMethod throw new WebDAVServerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e); } } + + /** + * Can be used after a successful {@link #execute()} invocation to + * check whether the resource was new (created) or over-writing existing + * content. + * + * @return true if the content was newly created, false if existing. + */ + public boolean isCreated() + { + return created; + } }