Class DefaultActionProxy

java.lang.Object
org.apache.struts2.DefaultActionProxy
All Implemented Interfaces:
Serializable, ActionProxy
Direct Known Subclasses:
StrutsActionProxy

public class DefaultActionProxy extends Object implements ActionProxy, Serializable
The Default ActionProxy implementation
Since:
2005-8-6
Author:
Rainer Hermanns, Revised by Henry Hu, tmjee
See Also:
  • Field Details

  • Constructor Details

    • DefaultActionProxy

      protected DefaultActionProxy(ActionInvocation inv, String namespace, String actionName, String methodName, boolean executeResult, boolean cleanupContext)
      This constructor is private so the builder methods (create*) should be used to create an DefaultActionProxy.

      The reason for the builder methods is so that you can use a subclass to create your own DefaultActionProxy instance

      (like a RMIActionProxy).
      Parameters:
      inv - the action invocation
      namespace - the namespace
      actionName - the action name
      methodName - the method name
      executeResult - execute result
      cleanupContext - cleanup context
  • Method Details

    • setObjectFactory

      public void setObjectFactory(ObjectFactory factory)
    • setConfiguration

      public void setConfiguration(Configuration config)
    • setUnknownHandler

      public void setUnknownHandler(UnknownHandlerManager unknownHandlerManager)
    • setActionEventListener

      public void setActionEventListener(ActionEventListener listener)
    • setLocalizedTextProvider

      public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider)
    • getAction

      public Object getAction()
      Description copied from interface: ActionProxy
      Gets the Action instance for this Proxy.
      Specified by:
      getAction in interface ActionProxy
      Returns:
      the Action instance
    • getActionName

      public String getActionName()
      Description copied from interface: ActionProxy
      Gets the alias name this ActionProxy is mapped to.
      Specified by:
      getActionName in interface ActionProxy
      Returns:
      the alias name
    • getConfig

      public ActionConfig getConfig()
      Description copied from interface: ActionProxy
      Gets the ActionConfig this ActionProxy is built from.
      Specified by:
      getConfig in interface ActionProxy
      Returns:
      the ActionConfig
    • setExecuteResult

      public void setExecuteResult(boolean executeResult)
      Description copied from interface: ActionProxy
      Sets whether this ActionProxy should also execute the Result after executing the Action.
      Specified by:
      setExecuteResult in interface ActionProxy
      Parameters:
      executeResult - true to also execute the Result.
    • getExecuteResult

      public boolean getExecuteResult()
      Description copied from interface: ActionProxy
      Gets the status of whether the ActionProxy is set to execute the Result after the Action is executed.
      Specified by:
      getExecuteResult in interface ActionProxy
      Returns:
      the status
    • getInvocation

      public ActionInvocation getInvocation()
      Specified by:
      getInvocation in interface ActionProxy
    • getNamespace

      public String getNamespace()
      Description copied from interface: ActionProxy
      Gets the namespace the ActionConfig for this ActionProxy is mapped to.
      Specified by:
      getNamespace in interface ActionProxy
      Returns:
      the namespace
    • execute

      public String execute() throws Exception
      Description copied from interface: ActionProxy
      Execute this ActionProxy. This will set the ActionContext from the ActionInvocation into the ActionContext ThreadLocal before invoking the ActionInvocation, then set the old ActionContext back into the ThreadLocal.
      Specified by:
      execute in interface ActionProxy
      Returns:
      the result code returned from executing the ActionInvocation
      Throws:
      Exception - can be thrown.
      See Also:
    • getMethod

      public String getMethod()
      Description copied from interface: ActionProxy
      Gets the method name to execute, or null if no method has been specified (meaning execute will be invoked).
      Specified by:
      getMethod in interface ActionProxy
      Returns:
      the method to execute
    • prepare

      protected void prepare()
    • prepareNotAllowedErrorMessage

      protected String prepareNotAllowedErrorMessage()
    • getErrorMessage

      protected String getErrorMessage()
    • isMethodSpecified

      public boolean isMethodSpecified()
      Description copied from interface: ActionProxy
      Gets status of the method value's initialization.
      Specified by:
      isMethodSpecified in interface ActionProxy
      Returns:
      true if the method returned by getMethod() is not a default initializer value.