Home » xwork-2.1.5 » com.opensymphony » xwork2 » [javadoc | source]
public class: ActionContext [javadoc | source]

All Implemented Interfaces:

The ActionContext is the context in which an Action is executed. Each context is basically a container of objects an action needs for execution like the session, parameters, locale, etc.

The ActionContext is thread local which means that values stored in the ActionContext are unique per thread. See the ThreadLocal class for more information. The benefit of this is you don't need to worry about a user specific action context, you just get it:

Finally, because of the thread local usage you don't need to worry about making your actions thread safe.

Field Summary
static  ThreadLocal actionContext     
public static final  String ACTION_NAME    Constant for the name of the action being executed. 
public static final  String VALUE_STACK    Constant for the OGNL value stack
public static final  String SESSION    Constant for the action's session. 
public static final  String APPLICATION    Constant for the action's application context. 
public static final  String PARAMETERS    Constant for the action's parameters. 
public static final  String LOCALE    Constant for the action's locale. 
public static final  String TYPE_CONVERTER    Constant for the action's type converter. 
public static final  String ACTION_INVOCATION    Constant for the action's invocation context. 
public static final  String CONVERSION_ERRORS    Constant for the map of type conversion errors. 
public static final  String CONTAINER    Constant for the container 
 Map<String, Object> context     
 public ActionContext(Map<String, Object> context) 
    Creates a new ActionContext initialized with another context.
    context - a context map.
Method from com.opensymphony.xwork2.ActionContext Summary:
get,   getActionInvocation,   getApplication,   getContainer,   getContext,   getContextMap,   getConversionErrors,   getInstance,   getLocale,   getName,   getParameters,   getSession,   getValueStack,   put,   setActionInvocation,   setApplication,   setContainer,   setContext,   setContextMap,   setConversionErrors,   setLocale,   setName,   setParameters,   setSession,   setValueStack
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.opensymphony.xwork2.ActionContext Detail:
 public Object get(String key) 
    Returns a value that is stored in the current ActionContext by doing a lookup using the value's key.
 public ActionInvocation getActionInvocation() 
    Gets the action invocation (the execution state).
 public Map<String, Object> getApplication() 
    Returns a Map of the ServletContext when in a servlet environment or a generic application level Map otherwise.
 public Container getContainer() 
    Sets the container for this request
 public static ActionContext getContext() 
    Returns the ActionContext specific to the current thread.
 public Map<String, Object> getContextMap() 
    Gets the context map.
 public Map<String, Object> getConversionErrors() 
    Gets the map of conversion errors which occurred when executing the action.
 public T getInstance(Class<T> type) 
 public Locale getLocale() 
    Gets the Locale of the current action. If no locale was ever specified the platform's default locale is used.
 public String getName() 
    Gets the name of the current Action.
 public Map<String, Object> getParameters() 
    Returns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of parameters otherwise.
 public Map<String, Object> getSession() 
    Gets the Map of HttpSession values when in a servlet environment or a generic session map otherwise.
 public ValueStack getValueStack() 
    Gets the OGNL value stack.
 public  void put(String key,
    Object value) 
    Stores a value in the current ActionContext. The value can be looked up using the key.
 public  void setActionInvocation(ActionInvocation actionInvocation) 
    Sets the action invocation (the execution state).
 public  void setApplication(Map<String, Object> application) 
    Sets the action's application context.
 public  void setContainer(Container cont) 
    Gets the container for this request
 public static  void setContext(ActionContext context) 
    Sets the action context for the current thread.
 public  void setContextMap(Map<String, Object> contextMap) 
    Sets the action's context map.
 public  void setConversionErrors(Map<String, Object> conversionErrors) 
    Sets conversion errors which occurred when executing the action.
 public  void setLocale(Locale locale) 
    Sets the Locale for the current action.
 public  void setName(String name) 
    Sets the name of the current Action in the ActionContext.
 public  void setParameters(Map<String, Object> parameters) 
    Sets the action parameters.
 public  void setSession(Map<String, Object> session) 
    Sets a map of action session values.
 public  void setValueStack(ValueStack stack) 
    Sets the OGNL value stack.