com.opensymphony.xwork2
Class DefaultActionProxy

java.lang.Object
  extended by com.opensymphony.xwork2.DefaultActionProxy
All Implemented Interfaces:
ActionProxy, Serializable
Direct Known Subclasses:
DWRValidator.ValidatorActionProxy, StrutsActionProxy

public class DefaultActionProxy
extends Object
implements ActionProxy, Serializable

The Default ActionProxy implementation

Since:
2005-8-6
Version:
$Date: 2007-03-31 18:32:47 +0200 (Sa, 31 Mrz 2007) $ $Id: DefaultActionProxy.java 1414 2007-03-31 16:32:47Z rainerh $
Author:
Rainer Hermanns, Revised by Henry Hu, tmjee
See Also:
Serialized Form

Field Summary
protected  ActionEventListener actionEventListener
           
protected  String actionName
           
protected  boolean cleanupContext
           
protected  ActionConfig config
           
protected  Configuration configuration
           
protected  boolean executeResult
           
protected  Map extraContext
           
protected  ActionInvocation invocation
           
private static Log LOG
           
protected  String method
           
protected  String namespace
           
protected  ObjectFactory objectFactory
           
private static long serialVersionUID
           
protected  UnknownHandler unknownHandler
           
 
Constructor Summary
protected DefaultActionProxy(String namespace, String actionName, Map extraContext, boolean executeResult, boolean cleanupContext)
          This constructor is private so the builder methods (create*) should be used to create an DefaultActionProxy.
 
Method Summary
 String execute()
          Execute this ActionProxy.
 Object getAction()
           
 String getActionName()
           
 ActionConfig getConfig()
           
 boolean getExecuteResult()
           
 ActionInvocation getInvocation()
           
 String getMethod()
          Returns the method to execute, or null if no method has been specified (meaning "execute" will be invoked)
 String getNamespace()
           
 void prepare()
          Called after all dependencies are set
private  void resolveMethod()
           
 void setActionEventListener(ActionEventListener listener)
           
 void setConfiguration(Configuration config)
           
 void setExecuteResult(boolean executeResult)
          Sets whether this ActionProxy should also execute the Result after executing the Action
 void setMethod(String method)
          Sets the method to execute for the action invocation.
 void setObjectFactory(ObjectFactory factory)
           
 void setUnknownHandler(UnknownHandler handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

LOG

private static final Log LOG

configuration

protected Configuration configuration

config

protected ActionConfig config

invocation

protected ActionInvocation invocation

unknownHandler

protected UnknownHandler unknownHandler

extraContext

protected Map extraContext

actionName

protected String actionName

namespace

protected String namespace

method

protected String method

executeResult

protected boolean executeResult

cleanupContext

protected boolean cleanupContext

objectFactory

protected ObjectFactory objectFactory

actionEventListener

protected ActionEventListener actionEventListener
Constructor Detail

DefaultActionProxy

protected DefaultActionProxy(String namespace,
                             String actionName,
                             Map extraContext,
                             boolean executeResult,
                             boolean cleanupContext)
                      throws Exception
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).

Throws:
Exception
Method Detail

setObjectFactory

public void setObjectFactory(ObjectFactory factory)

setConfiguration

public void setConfiguration(Configuration config)

setUnknownHandler

public void setUnknownHandler(UnknownHandler handler)

setActionEventListener

public void setActionEventListener(ActionEventListener listener)

getAction

public Object getAction()
Specified by:
getAction in interface ActionProxy
Returns:
the Action instance for this Proxy

getActionName

public String getActionName()
Specified by:
getActionName in interface ActionProxy
Returns:
the alias name this ActionProxy is mapped to

getConfig

public ActionConfig getConfig()
Specified by:
getConfig in interface ActionProxy
Returns:
the ActionConfig this ActionProxy is built from

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

getExecuteResult

public boolean getExecuteResult()
Specified by:
getExecuteResult in interface ActionProxy
Returns:
the status of whether the ActionProxy is set to execute the Result after the Action is executed

getInvocation

public ActionInvocation getInvocation()
Specified by:
getInvocation in interface ActionProxy
Returns:
the ActionInvocation associated with this ActionProxy

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface ActionProxy
Returns:
the namespace the ActionConfig for this ActionProxy is mapped to

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
See Also:
ActionInvocation

getMethod

public String getMethod()
Description copied from interface: ActionProxy
Returns the method to execute, or null if no method has been specified (meaning "execute" will be invoked)

Specified by:
getMethod in interface ActionProxy

setMethod

public void setMethod(String method)
Description copied from interface: ActionProxy
Sets the method to execute for the action invocation. If no method is specified, the method provided by in the action's configuration will be used.

Specified by:
setMethod in interface ActionProxy
Parameters:
method - the string name of the method to invoke

resolveMethod

private void resolveMethod()

prepare

public void prepare()
             throws Exception
Description copied from interface: ActionProxy
Called after all dependencies are set

Specified by:
prepare in interface ActionProxy
Throws:
Exception


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.