WebDAV: separation of command execution and response generation.

* created hook that allows separation of command execution and response generation.
* refactored PropPatchMethod to use the new hook.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34483 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2012-03-08 14:10:12 +00:00
parent 54f8536561
commit 65b08c4805
2 changed files with 94 additions and 51 deletions

View File

@@ -335,6 +335,7 @@ public abstract class WebDAVMethod
boolean isReadOnly = isReadOnly();
// Execute the method
getTransactionService().getRetryingTransactionHelper().doInTransaction(executeImplCallback, isReadOnly);
generateResponseImpl();
}
catch (AccessDeniedException e)
{
@@ -384,6 +385,20 @@ public abstract class WebDAVMethod
*/
protected abstract void executeImpl() throws WebDAVServerException, Exception;
/**
* Does nothing unless overridden - for reasons of backwards compatibility. Subclasses
* implementing this method should separate the WebDAV method execution logic from
* response generation logic. Execution logic should be contained in the {@link #executeImpl} method
* and should NOT contain any code that writes to the response. Conversely response generation logic
* should NOT contain any code relating to the desired effect of the WebDAV method (e.g. setting properties
* on a node) and should be contained purely within this method.
* <p>
* Older methods, until refactored will not override this method, relying only on {@link #executeImpl()}.
*/
protected void generateResponseImpl() throws Exception
{
}
/**
* Parses the given request body represented as an XML document and sets any necessary context
* ready for execution.