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
This commit is contained in:
Matt Ward
2012-03-22 16:47:04 +00:00
parent 262f7c8da6
commit 899af82bc6

View File

@@ -45,10 +45,10 @@ public class PutMethod extends WebDAVMethod
// Request parameters // Request parameters
private String m_strContentType = null; private String m_strContentType = null;
private boolean m_expectHeaderPresent = false; private boolean m_expectHeaderPresent = false;
// Indicates if a zero byte node was created by a LOCK call. // Indicates if a zero byte node was created by a LOCK call.
// Try to delete the node if the PUT fails // Try to delete the node if the PUT fails
private boolean noContent = false; private boolean noContent = false;
private boolean created = false;
/** /**
* Default constructor * Default constructor
@@ -150,7 +150,6 @@ public class PutMethod extends WebDAVMethod
// Get the status for the request path // Get the status for the request path
FileInfo contentNodeInfo = null; FileInfo contentNodeInfo = null;
boolean created = false;
try try
{ {
contentNodeInfo = getDAVHelper().getNodeForPath(getRootNodeRef(), getPath(), getServletPath()); contentNodeInfo = getDAVHelper().getNodeForPath(getRootNodeRef(), getPath(), getServletPath());
@@ -266,4 +265,16 @@ public class PutMethod extends WebDAVMethod
throw new WebDAVServerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e); 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;
}
} }