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