Package webwork.action
Class ActionContext
java.lang.Object
webwork.action.ActionContext
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.
- Version:
- $Revision: 1.14 $
- Author:
- Rickard Öberg (rickard@middleware-company.com), Matt Baldree (matt@smallleap.com), Maurice C. Parker (maurice@vineyardenterprise.com)
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a value that is stored in the current ActionContext buy doing a lookup using the value's key.static MapReturns a Map of the ServletContext when in a servlet environment or a generic application level Map otherwise.static ActionContextReturns the ActionContext specific to the current thread.static LocaleReturns the Locale of the current request in a servlet environment or the default Locale in other environments.static MultiPartRequestWrapperReturn multipart request for HttpServletRequest.static StringgetName()Returns the name of the current Action.static MapReturns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of parameters otherwise.static PrincipalReturns the current user's security Principal.static javax.servlet.http.HttpServletRequestReturns the HttpServletRequest object when in a servlet environment.javax.servlet.http.HttpServletRequeststatic javax.servlet.http.HttpServletResponseReturns the HttpServletResponse when in a servlet environment.javax.servlet.http.HttpServletResponsestatic javax.servlet.ServletContextReturns the ServletContext when in a servlet environment.javax.servlet.ServletContextstatic MapReturns the HttpSession when in a servlet environment or a generic session map otherwise.static MapGet the current ActionContext parameters.getTable()static ValueStackReturns the ValueStack specific to the current thread.voidStores a value in the current ActionContext.static voidsetApplication(Map application) Set an application level Map.voidsetApplicationImpl(Map application) static voidsetContext(ActionContext aContext) static voidSet the current locale.voidsetLocaleImpl(Locale locale) static voidStores the name of the current Action in the ActionContext.voidsetNameImpl(String name) static voidsetParameters(Map parameters) Set a Map of parameters.voidsetParametersImpl(Map parameters) static voidsetPrincipal(Principal principal) Set the current user's security Principal.voidsetPrincipalImpl(Principal principal) static voidsetRequest(javax.servlet.http.HttpServletRequest request) Set the HttpServletRequest.voidsetRequestImpl(javax.servlet.http.HttpServletRequest request) static voidsetResponse(javax.servlet.http.HttpServletResponse response) Set the HttpServletResponse.voidsetResponseImpl(javax.servlet.http.HttpServletResponse response) static voidsetServletContext(javax.servlet.ServletContext context) Set the ServletContext.voidsetServletContextImpl(javax.servlet.ServletContext context) static voidsetSession(Map session) Set a session Map.voidsetSessionImpl(Map session) static voidsetSingleValueParameters(Map parameters) Set a Map of single value parameters.voidsetSingleValueParametersImpl(Map parameters) voidstatic voidsetValueStack(ValueStack valueStack) Set the ValueStack.voidsetValueStackImpl(ValueStack valueStack)
-
Field Details
-
ACTION_NAME
- See Also:
-
SESSION
- See Also:
-
APPLICATION
- See Also:
-
PARAMETERS
- See Also:
-
SINGLE_VALUE_PARAMETERS
- See Also:
-
LOCALE
- See Also:
-
PRINCIPAL
- See Also:
-
-
Constructor Details
-
ActionContext
public ActionContext()
-
-
Method Details
-
setContext
-
getContext
Returns the ActionContext specific to the current thread.- Returns:
- ActionContext for the current thread
-
getTable
-
setTable
-
put
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.
-
get
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.
-
getName
Returns the name of the current Action.- Returns:
- The current Action name.
-
getNameImpl
-
setName
Stores the name of the current Action in the ActionContext.- Parameters:
name- The name of the current action.
-
setNameImpl
-
getLocale
Returns the Locale of the current request in a servlet environment or the default Locale in other environments.- Returns:
- current locale
-
getLocaleImpl
-
setLocale
Set the current locale.- Parameters:
locale- current locale
-
setLocaleImpl
-
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
-
getSessionImpl
-
setSession
Set a session Map. -
setSessionImpl
-
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
-
getApplicationImpl
-
setApplication
Set an application level Map. -
setApplicationImpl
-
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.
-
getParametersImpl
-
setParameters
Set a Map of parameters.- Parameters:
parameters- The parameters for the current action context.
-
setParametersImpl
-
getSingleValueParameters
Get the current ActionContext parameters. Each Map entry is a String.- Returns:
- The parameters for the current action context.
-
getSingleValueParametersImpl
-
setSingleValueParameters
Set a Map of single value parameters.- Parameters:
parameters- for the current action context.
-
setSingleValueParametersImpl
-
getPrincipal
Returns the current user's security Principal.- Returns:
- the current user's security Principal
-
getPrincipalImpl
-
setPrincipal
Set the current user's security Principal.- Parameters:
principal- the current user's security Principal
-
setPrincipalImpl
-
getMultiPartRequest
Return multipart request for HttpServletRequest.- Returns:
- MultiPartRequestWrapper
-
getMultiPartRequestImpl
-
getRequest
public static javax.servlet.http.HttpServletRequest getRequest()Returns the HttpServletRequest object when in a servlet environment.- Returns:
- HttpServletRequest in a servlet environment or null otherwise
-
getRequestImpl
public javax.servlet.http.HttpServletRequest getRequestImpl() -
setRequest
public static void setRequest(javax.servlet.http.HttpServletRequest request) Set the HttpServletRequest. -
setRequestImpl
public void setRequestImpl(javax.servlet.http.HttpServletRequest request) -
getResponse
public static javax.servlet.http.HttpServletResponse getResponse()Returns the HttpServletResponse when in a servlet environment.- Returns:
- HttpServletResponse or null
-
getResponseImpl
public javax.servlet.http.HttpServletResponse getResponseImpl() -
setResponse
public static void setResponse(javax.servlet.http.HttpServletResponse response) Set the HttpServletResponse. -
setResponseImpl
public void setResponseImpl(javax.servlet.http.HttpServletResponse response) -
getServletContext
public static javax.servlet.ServletContext getServletContext()Returns the ServletContext when in a servlet environment.- Returns:
- ServletContext or null.
-
getServletContextImpl
public javax.servlet.ServletContext getServletContextImpl() -
setServletContext
public static void setServletContext(javax.servlet.ServletContext context) Set the ServletContext. -
setServletContextImpl
public void setServletContextImpl(javax.servlet.ServletContext context) -
getValueStack
Returns the ValueStack specific to the current thread.- Returns:
- ActionContext for the current thread
-
getValueStackImpl
-
setValueStack
Set the ValueStack.- Parameters:
valueStack-
-
setValueStackImpl
-