Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)

122630 gjames: RA-211: Moving the response callback down a level


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126488 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 11:10:50 +00:00
parent 5e0d82127d
commit 72dacb9c79
7 changed files with 12 additions and 10 deletions

View File

@@ -152,7 +152,7 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
public Object execute() throws Throwable
{
Object result = executeAction(resource, params);
Object result = executeAction(resource, params, callBack);
if (result instanceof BinaryResource)
{
return result; //don't postprocess it.
@@ -164,8 +164,6 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
return toReturn;
}
public abstract Object executeAction(ResourceWithMetadata resource, Params params) throws Throwable;
protected void streamResponse(final WebScriptRequest req, final WebScriptResponse res, BinaryResource resource) throws IOException
{
if (resource instanceof FileBinaryResource)

View File

@@ -88,7 +88,8 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
* @param params parameters to use
* @return anObject the result of the execute
*/
public Object executeAction(ResourceWithMetadata resource, Params params)
@Override
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse)
{
switch (resource.getMetaData().getType())
{
@@ -149,7 +150,7 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
@Override
public Void execute() throws Throwable
{
executeAction(resource, params); //ignore return result
executeAction(resource, params, callBack); //ignore return result
return null;
}
}, false, true);

View File

@@ -117,7 +117,7 @@ public class ResourceWebScriptGet extends AbstractResourceWebScript implements P
* @return anObject the result of the execute
*/
@Override
public Object executeAction(ResourceWithMetadata resource, Params params) throws Throwable
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse) throws Throwable
{
switch (resource.getMetaData().getType())

View File

@@ -69,6 +69,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.map.JsonMappingException;
import org.springframework.beans.BeanUtils;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
import org.springframework.http.HttpMethod;
@@ -628,8 +629,9 @@ public class ResourceWebScriptHelper
paramFilter = filters.get(resourceKey);
}
final Params executionParams = Params.valueOf(paramFilter, uniqueEntityId, params.getRequest());
final ResponseCallBack callBack = new ResponseCallBack(Status.STATUS_OK,ApiWebScript.DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
//Read only because this only occurs for GET requests
Object result = executor.executeAction(resource, executionParams);
Object result = executor.executeAction(resource, executionParams, callBack);
return processAdditionsToTheResponse(null, api, null, executionParams, result);
}
catch(NotFoundException e)

View File

@@ -211,7 +211,7 @@ public class ResourceWebScriptPost extends AbstractResourceWebScript implements
* @return anObject the result of the execute
*/
@Override
public Object executeAction(ResourceWithMetadata resource, Params params) throws Throwable
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse) throws Throwable
{
final Object resObj = resource.getResource();

View File

@@ -180,7 +180,7 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
* @return anObject the result of the execute
*/
@Override
public Object executeAction(ResourceWithMetadata resource, Params params) throws Throwable
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse) throws Throwable
{
switch (resource.getMetaData().getType())
{