Merged HEAD (5.2) to 5.2.N (5.2.1)

127571 jkaabimofrad: Merged API-STRIKES-BACK (5.2.0) to HEAD (5.2)
      126242 gjames: RA-878:All api errors should return the standard error object


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@127665 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-06-03 14:14:04 +00:00
parent 4521ecaed9
commit b2fe847b6c
24 changed files with 364 additions and 236 deletions

View File

@@ -41,6 +41,7 @@ import org.alfresco.rest.framework.resource.actions.interfaces.BinaryResourceAct
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceBinaryAction;
import org.alfresco.rest.framework.resource.actions.interfaces.ResourceAction;
import org.alfresco.rest.framework.tools.ApiAssistant;
import org.apache.commons.lang.StringUtils;
import org.springframework.extensions.webscripts.ArgumentTypeDescription;
import org.springframework.extensions.webscripts.Container;
@@ -216,7 +217,7 @@ public class PublicApiDeclarativeRegistry extends DeclarativeRegistry
if (templateVars.get("apiName") != null)
{
// NOTE: noAuth currently only exposed for GET or Create Ticket (login)
Api api = determineApi(templateVars);
Api api = ApiAssistant.determineApi(templateVars);
// TODO can we avoid locating resource more than once (or at least provide a common code to determine the GET resourceAction) ?
return locator.locateResource(api, templateVars, method);
@@ -428,15 +429,6 @@ public class PublicApiDeclarativeRegistry extends DeclarativeRegistry
return new Match(match.getTemplate(), match.getTemplateVars(), match.getPath(), noAuthWebScriptWrapper);
}
// note: same as ApiWebscript (apiName must not be null)
private Api determineApi(Map<String, String> templateVars)
{
String apiScope = templateVars.get("apiScope");
String apiVersion = templateVars.get("apiVersion");
String apiName = templateVars.get("apiName");
return Api.valueOf(apiName,apiScope,apiVersion);
}
private void initWebScript(WebScript webScript, String name)
{
DescriptionImpl serviceDesc = new DescriptionImpl(name, name, name, name);