Class RestActionInvocation

java.lang.Object
org.apache.struts2.DefaultActionInvocation
org.apache.struts2.rest.RestActionInvocation
All Implemented Interfaces:
ActionInvocation

public class RestActionInvocation extends DefaultActionInvocation
Extends the usual ActionInvocation to add support for processing the object returned from the action execution. This allows us to support methods that return HttpHeaders as well as apply content type-specific operations to the result.
  • Field Details

    • httpHeaders

      protected HttpHeaders httpHeaders
    • target

      protected Object target
    • isFirstInterceptor

      protected boolean isFirstInterceptor
    • hasErrors

      protected boolean hasErrors
  • Constructor Details

    • RestActionInvocation

      protected RestActionInvocation(Map<String,Object> extraContext, boolean pushAction)
  • Method Details

    • setLogger

      public void setLogger(String logger)
    • setDefaultErrorResultName

      public void setDefaultErrorResultName(String defaultErrorResultName)
    • setRestrictToGet

      public void setRestrictToGet(String restrictToGet)
      If set to true (by default) blocks returning content from any other methods than GET, if set to false, the content can be returned for any kind of method
      Parameters:
      restrictToGet - true or false
    • setMimeTypeHandlerSelector

      public void setMimeTypeHandlerSelector(ContentTypeHandlerManager selector)
    • saveResult

      protected String saveResult(ActionConfig actionConfig, Object methodResult)
      Save the result to be used later.
      Overrides:
      saveResult in class DefaultActionInvocation
      Parameters:
      actionConfig - current ActionConfig
      methodResult - the result of the action.
      Returns:
      the result code to process.
      Throws:
      ConfigurationException - If it is an incorrect result.
    • invoke

      public String invoke() throws Exception
      Specified by:
      invoke in interface ActionInvocation
      Overrides:
      invoke in class DefaultActionInvocation
      Throws:
      Exception
    • processResult

      protected void processResult() throws Exception
      Throws:
      Exception
    • updateStatusFromResult

      protected void updateStatusFromResult()
      Get the status code from HttpHeaderResult and it is saved in the HttpHeaders object.
    • selectTarget

      protected void selectTarget()