mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -4,6 +4,7 @@ import org.alfresco.rest.framework.core.HttpMethodSupport;
|
|||||||
import org.alfresco.rest.framework.core.ResourceWithMetadata;
|
import org.alfresco.rest.framework.core.ResourceWithMetadata;
|
||||||
import org.alfresco.rest.framework.resource.content.ContentInfo;
|
import org.alfresco.rest.framework.resource.content.ContentInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||||
|
import org.alfresco.rest.framework.webscripts.ResponseCallBack;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
import org.springframework.extensions.webscripts.WebScriptResponse;
|
import org.springframework.extensions.webscripts.WebScriptResponse;
|
||||||
|
|
||||||
@@ -21,6 +22,6 @@ public interface ActionExecutor extends HttpMethodSupport
|
|||||||
* @param params Params
|
* @param params Params
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public Object executeAction(ResourceWithMetadata resource, Params params) throws Throwable;
|
public Object executeAction(ResourceWithMetadata resource, Params params, ResponseCallBack withResponse) throws Throwable;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -152,7 +152,7 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
|
|||||||
public Object execute() throws Throwable
|
public Object execute() throws Throwable
|
||||||
{
|
{
|
||||||
|
|
||||||
Object result = executeAction(resource, params);
|
Object result = executeAction(resource, params, callBack);
|
||||||
if (result instanceof BinaryResource)
|
if (result instanceof BinaryResource)
|
||||||
{
|
{
|
||||||
return result; //don't postprocess it.
|
return result; //don't postprocess it.
|
||||||
@@ -164,8 +164,6 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
|
|||||||
return toReturn;
|
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
|
protected void streamResponse(final WebScriptRequest req, final WebScriptResponse res, BinaryResource resource) throws IOException
|
||||||
{
|
{
|
||||||
if (resource instanceof FileBinaryResource)
|
if (resource instanceof FileBinaryResource)
|
||||||
|
@@ -88,7 +88,8 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
|
|||||||
* @param params parameters to use
|
* @param params parameters to use
|
||||||
* @return anObject the result of the execute
|
* @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())
|
switch (resource.getMetaData().getType())
|
||||||
{
|
{
|
||||||
@@ -149,7 +150,7 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
|
|||||||
@Override
|
@Override
|
||||||
public Void execute() throws Throwable
|
public Void execute() throws Throwable
|
||||||
{
|
{
|
||||||
executeAction(resource, params); //ignore return result
|
executeAction(resource, params, callBack); //ignore return result
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, false, true);
|
}, false, true);
|
||||||
|
@@ -117,7 +117,7 @@ public class ResourceWebScriptGet extends AbstractResourceWebScript implements P
|
|||||||
* @return anObject the result of the execute
|
* @return anObject the result of the execute
|
||||||
*/
|
*/
|
||||||
@Override
|
@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())
|
switch (resource.getMetaData().getType())
|
||||||
|
@@ -69,6 +69,7 @@ import org.apache.commons.logging.Log;
|
|||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.codehaus.jackson.map.JsonMappingException;
|
import org.codehaus.jackson.map.JsonMappingException;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.extensions.webscripts.Status;
|
||||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||||
import org.springframework.extensions.webscripts.WebScriptResponse;
|
import org.springframework.extensions.webscripts.WebScriptResponse;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
@@ -628,8 +629,9 @@ public class ResourceWebScriptHelper
|
|||||||
paramFilter = filters.get(resourceKey);
|
paramFilter = filters.get(resourceKey);
|
||||||
}
|
}
|
||||||
final Params executionParams = Params.valueOf(paramFilter, uniqueEntityId, params.getRequest());
|
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
|
//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);
|
return processAdditionsToTheResponse(null, api, null, executionParams, result);
|
||||||
}
|
}
|
||||||
catch(NotFoundException e)
|
catch(NotFoundException e)
|
||||||
|
@@ -211,7 +211,7 @@ public class ResourceWebScriptPost extends AbstractResourceWebScript implements
|
|||||||
* @return anObject the result of the execute
|
* @return anObject the result of the execute
|
||||||
*/
|
*/
|
||||||
@Override
|
@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();
|
final Object resObj = resource.getResource();
|
||||||
|
|
||||||
|
@@ -180,7 +180,7 @@ public class ResourceWebScriptPut extends AbstractResourceWebScript implements P
|
|||||||
* @return anObject the result of the execute
|
* @return anObject the result of the execute
|
||||||
*/
|
*/
|
||||||
@Override
|
@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())
|
switch (resource.getMetaData().getType())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user