public class

ActionContext

extends Object
java.lang.Object
   ↳ webwork.action.ActionContext

Class Overview

Handles the context of each invoked action while providing an abstraction layer for both servlet and non servlet based applications.

Information is associated with the action's thread so it can be accessed from anywhere by calling a static method.

The context is initially set by the dispatcher.

Summary

Constants
String ACTION_NAME
String APPLICATION
String LOCALE
String PARAMETERS
String PRINCIPAL
String SESSION
String SINGLE_VALUE_PARAMETERS
Public Constructors
ActionContext()
Public Methods
Object get(Object key)
Returns a value that is stored in the current ActionContext buy doing a lookup using the value's key.
static Map getApplication()
Returns a Map of the ServletContext when in a servlet environment or a generic application level Map otherwise.
Map getApplicationImpl()
static ActionContext getContext()
Returns the ActionContext specific to the current thread.
static Locale getLocale()
Returns the Locale of the current request in a servlet environment or the default Locale in other environments.
Locale getLocaleImpl()
static MultiPartRequestWrapper getMultiPartRequest()
Return multipart request for HttpServletRequest.
MultiPartRequestWrapper getMultiPartRequestImpl()
static String getName()
Returns the name of the current Action.
String getNameImpl()
static Map getParameters()
Returns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of parameters otherwise.
Map getParametersImpl()
static Principal getPrincipal()
Returns the current user's security Principal.
Principal getPrincipalImpl()
static HttpServletRequest getRequest()
Returns the HttpServletRequest object when in a servlet environment.
HttpServletRequest getRequestImpl()
static HttpServletResponse getResponse()
Returns the HttpServletResponse when in a servlet environment.
HttpServletResponse getResponseImpl()
static ServletContext getServletContext()
Returns the ServletContext when in a servlet environment.
ServletContext getServletContextImpl()
static Map getSession()
Returns the HttpSession when in a servlet environment or a generic session map otherwise.
Map getSessionImpl()
static Map getSingleValueParameters()
Get the current ActionContext parameters.
Map getSingleValueParametersImpl()
Map getTable()
static ValueStack getValueStack()
Returns the ValueStack specific to the current thread.
ValueStack getValueStackImpl()
void put(Object key, Object value)
Stores a value in the current ActionContext.
static void setApplication(Map application)
Set an application level Map.
void setApplicationImpl(Map application)
static void setContext(ActionContext aContext)
static void setLocale(Locale locale)
Set the current locale.
void setLocaleImpl(Locale locale)
static void setName(String name)
Stores the name of the current Action in the ActionContext.
void setNameImpl(String name)
static void setParameters(Map parameters)
Set a Map of parameters.
void setParametersImpl(Map parameters)
static void setPrincipal(Principal principal)
Set the current user's security Principal.
void setPrincipalImpl(Principal principal)
static void setRequest(HttpServletRequest request)
Set the HttpServletRequest.
void setRequestImpl(HttpServletRequest request)
static void setResponse(HttpServletResponse response)
Set the HttpServletResponse.
void setResponseImpl(HttpServletResponse response)
static void setServletContext(ServletContext context)
Set the ServletContext.
void setServletContextImpl(ServletContext context)
static void setSession(Map session)
Set a session Map.
void setSessionImpl(Map session)
static void setSingleValueParameters(Map parameters)
Set a Map of single value parameters.
void setSingleValueParametersImpl(Map parameters)
void setTable(Map lookup)
static void setValueStack(ValueStack valueStack)
Set the ValueStack.
void setValueStackImpl(ValueStack valueStack)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_NAME

Constant Value: "webwork.action.ActionContext.name"

public static final String APPLICATION

Constant Value: "webwork.action.ActionContext.application"

public static final String LOCALE

Constant Value: "webwork.action.ActionContext.locale"

public static final String PARAMETERS

Constant Value: "webwork.action.ActionContext.parameters"

public static final String PRINCIPAL

Constant Value: "webwork.action.ActionContext.principal"

public static final String SESSION

Constant Value: "webwork.action.ActionContext.action"

public static final String SINGLE_VALUE_PARAMETERS

Constant Value: "webwork.action.ActionContext.singleValueParameters"

Public Constructors

public ActionContext ()

Public Methods

public Object get (Object key)

Returns a value that is stored in the current ActionContext buy doing a lookup using the value's key.

Parameters
key The key used to find the value.
Returns
  • The value that was found using the key.

public static Map getApplication ()

Returns a Map of the ServletContext when in a servlet environment or a generic application level Map otherwise.

Returns
  • Map of ServletContext or generic application level Map

public Map getApplicationImpl ()

public static ActionContext getContext ()

Returns the ActionContext specific to the current thread.

Returns
  • ActionContext for the current thread

public static Locale getLocale ()

Returns the Locale of the current request in a servlet environment or the default Locale in other environments.

Returns
  • current locale

public Locale getLocaleImpl ()

public static MultiPartRequestWrapper getMultiPartRequest ()

Return multipart request for HttpServletRequest.

Returns
  • MultiPartRequestWrapper

public MultiPartRequestWrapper getMultiPartRequestImpl ()

public static String getName ()

Returns the name of the current Action.

Returns
  • The current Action name.

public String getNameImpl ()

public static Map getParameters ()

Returns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of parameters otherwise.

Returns
  • Map of HttpServletRequest parameters, generic Map of parameters, or multipart Map.

public Map getParametersImpl ()

public static Principal getPrincipal ()

Returns the current user's security Principal.

Returns
  • the current user's security Principal

public Principal getPrincipalImpl ()

public static HttpServletRequest getRequest ()

Returns the HttpServletRequest object when in a servlet environment.

Returns
  • HttpServletRequest in a servlet environment or null otherwise

public HttpServletRequest getRequestImpl ()

public static HttpServletResponse getResponse ()

Returns the HttpServletResponse when in a servlet environment.

Returns
  • HttpServletResponse or null

public HttpServletResponse getResponseImpl ()

public static ServletContext getServletContext ()

Returns the ServletContext when in a servlet environment.

Returns
  • ServletContext or null.

public ServletContext getServletContextImpl ()

public static Map getSession ()

Returns the HttpSession when in a servlet environment or a generic session map otherwise.

Returns
  • a map of HttpSession or a generic session map

public Map getSessionImpl ()

public static Map getSingleValueParameters ()

Get the current ActionContext parameters. Each Map entry is a String.

Returns
  • The parameters for the current action context.

public Map getSingleValueParametersImpl ()

public Map getTable ()

public static ValueStack getValueStack ()

Returns the ValueStack specific to the current thread.

Returns
  • ActionContext for the current thread

public ValueStack getValueStackImpl ()

public void put (Object key, Object value)

Stores a value in the current ActionContext. The value can be looked up using the key.

Parameters
key The key of the value.
value The value to be stored.

public static void setApplication (Map application)

Set an application level Map.

public void setApplicationImpl (Map application)

public static void setContext (ActionContext aContext)

public static void setLocale (Locale locale)

Set the current locale.

Parameters
locale current locale

public void setLocaleImpl (Locale locale)

public static void setName (String name)

Stores the name of the current Action in the ActionContext.

Parameters
name The name of the current action.

public void setNameImpl (String name)

public static void setParameters (Map parameters)

Set a Map of parameters.

Parameters
parameters The parameters for the current action context.

public void setParametersImpl (Map parameters)

public static void setPrincipal (Principal principal)

Set the current user's security Principal.

Parameters
principal the current user's security Principal

public void setPrincipalImpl (Principal principal)

public static void setRequest (HttpServletRequest request)

Set the HttpServletRequest.

public void setRequestImpl (HttpServletRequest request)

public static void setResponse (HttpServletResponse response)

Set the HttpServletResponse.

public void setResponseImpl (HttpServletResponse response)

public static void setServletContext (ServletContext context)

Set the ServletContext.

public void setServletContextImpl (ServletContext context)

public static void setSession (Map session)

Set a session Map.

public void setSessionImpl (Map session)

public static void setSingleValueParameters (Map parameters)

Set a Map of single value parameters.

Parameters
parameters for the current action context.

public void setSingleValueParametersImpl (Map parameters)

public void setTable (Map lookup)

public static void setValueStack (ValueStack valueStack)

Set the ValueStack.

public void setValueStackImpl (ValueStack valueStack)