Class RestScriptsController

java.lang.Object
org.craftercms.engine.controller.rest.RestScriptsController
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.web.context.ServletContextAware

@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 Details

    • DEFAULT_RESPONSE_BODY_MODEL_ATTR_NAME

      public static final String DEFAULT_RESPONSE_BODY_MODEL_ATTR_NAME
      See Also:
    • DEFAULT_ERROR_MESSAGE_MODEL_ATTR_NAME

      public static final String DEFAULT_ERROR_MESSAGE_MODEL_ATTR_NAME
      See Also:
    • API_ROOT

      protected static final String API_ROOT
      See Also:
    • API_1_SERVICES_ROOT

      protected static final String API_1_SERVICES_ROOT
      See Also:
    • responseBodyModelAttributeName

      protected String responseBodyModelAttributeName
    • errorMessageModelAttributeName

      protected String errorMessageModelAttributeName
    • urlTemplateScanner

      protected ScriptUrlTemplateScanner urlTemplateScanner
    • disableVariableRestrictions

      protected boolean disableVariableRestrictions
    • pluginService

      protected PluginService pluginService
  • Constructor Details

    • RestScriptsController

      public RestScriptsController()
  • Method Details

    • setResponseBodyModelAttributeName

      public void setResponseBodyModelAttributeName(String responseBodyModelAttributeName)
    • setErrorMessageModelAttributeName

      public void setErrorMessageModelAttributeName(String errorMessageModelAttributeName)
    • setUrlTemplateScanner

      public void setUrlTemplateScanner(ScriptUrlTemplateScanner urlTemplateScanner)
    • setDisableVariableRestrictions

      public void setDisableVariableRestrictions(boolean disableVariableRestrictions)
    • setPluginService

      public void setPluginService(PluginService pluginService)
    • handleRequest

      @RequestMapping(path="/**", produces={"application/json","application/xml"}) protected org.springframework.http.ResponseEntity handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    • getServiceUrl

      protected String getServiceUrl(javax.servlet.http.HttpServletRequest request)
    • parseScriptUrlForVariables

      protected String parseScriptUrlForVariables(SiteContext siteContext, String scriptUrl, Map<String,Object> variables)
    • getScriptUrl

      protected String getScriptUrl(ScriptFactory scriptFactory, SiteContext siteContext, javax.servlet.http.HttpServletRequest request, String serviceUrl)
    • createScriptVariables

      protected Map<String,Object> createScriptVariables(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    • executeScript

      protected Object executeScript(ScriptFactory scriptFactory, Map<String,Object> scriptVariables, javax.servlet.http.HttpServletResponse response, String scriptUrl)
    • checkHttpStatusCodeAwareException

      protected Throwable checkHttpStatusCodeAwareException(Exception e, javax.servlet.http.HttpServletResponse response)
    • checkValidationException

      protected Throwable checkValidationException(Exception e, javax.servlet.http.HttpServletResponse response)
    • setServletContext

      public void setServletContext(javax.servlet.ServletContext servletContext)
      Specified by:
      setServletContext in interface org.springframework.web.context.ServletContextAware