Class RestScriptsController
java.lang.Object
org.craftercms.engine.controller.rest.RestScriptsController
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.web.context.ServletContextAware
@RestController
@RequestMapping(path={"/api","/api/1/services"})
public class RestScriptsController
extends Object
implements org.springframework.web.context.ServletContextAware
Controller for REST script requests.
- Author:
- Alfonso Vásquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringstatic final Stringstatic final Stringprotected booleanprotected Stringprotected PluginServiceprotected Stringprotected ScriptUrlTemplateScanner -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ThrowablecheckHttpStatusCodeAwareException(Exception e, jakarta.servlet.http.HttpServletResponse response) protected ThrowablecheckValidationException(Exception e, jakarta.servlet.http.HttpServletResponse response) createScriptVariables(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected ObjectexecuteScript(ScriptFactory scriptFactory, Map<String, Object> scriptVariables, jakarta.servlet.http.HttpServletResponse response, String scriptUrl) protected StringgetScriptUrl(ScriptFactory scriptFactory, SiteContext siteContext, jakarta.servlet.http.HttpServletRequest request, String serviceUrl) protected StringgetServiceUrl(jakarta.servlet.http.HttpServletRequest request) protected org.springframework.http.ResponseEntityhandleRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected StringparseScriptUrlForVariables(SiteContext siteContext, String scriptUrl, Map<String, Object> variables) voidsetDisableVariableRestrictions(boolean disableVariableRestrictions) voidsetErrorMessageModelAttributeName(String errorMessageModelAttributeName) voidsetPluginService(PluginService pluginService) voidsetResponseBodyModelAttributeName(String responseBodyModelAttributeName) voidsetServletContext(jakarta.servlet.ServletContext servletContext) voidsetUrlTemplateScanner(ScriptUrlTemplateScanner urlTemplateScanner)
-
Field Details
-
DEFAULT_RESPONSE_BODY_MODEL_ATTR_NAME
- See Also:
-
DEFAULT_ERROR_MESSAGE_MODEL_ATTR_NAME
- See Also:
-
API_ROOT
- See Also:
-
API_1_SERVICES_ROOT
- See Also:
-
responseBodyModelAttributeName
-
errorMessageModelAttributeName
-
urlTemplateScanner
-
disableVariableRestrictions
protected boolean disableVariableRestrictions -
pluginService
-
-
Constructor Details
-
RestScriptsController
public RestScriptsController()
-
-
Method Details
-
setResponseBodyModelAttributeName
-
setErrorMessageModelAttributeName
-
setUrlTemplateScanner
-
setDisableVariableRestrictions
public void setDisableVariableRestrictions(boolean disableVariableRestrictions) -
setPluginService
-
handleRequest
@RequestMapping(path="/**", produces={"application/json","application/xml"}) protected org.springframework.http.ResponseEntity handleRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) -
getServiceUrl
-
parseScriptUrlForVariables
-
getScriptUrl
protected String getScriptUrl(ScriptFactory scriptFactory, SiteContext siteContext, jakarta.servlet.http.HttpServletRequest request, String serviceUrl) -
createScriptVariables
-
executeScript
-
checkHttpStatusCodeAwareException
-
checkValidationException
-
setServletContext
public void setServletContext(jakarta.servlet.ServletContext servletContext) - Specified by:
setServletContextin interfaceorg.springframework.web.context.ServletContextAware
-