public class ActionContext extends org.mvel2.ParserContext implements Serializable
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();| 限定符和类型 | 字段和说明 |
|---|---|
static String |
ACTION_INVOCATION
Constant for the action's
invocation context. |
static String |
ACTION_NAME
Constant for the name of the action being executed.
|
static String |
APPLICATION
Constant for the action's application context.
|
static String |
CONVERSION_ERRORS
Constant for the map of type conversion errors.
|
static String |
LOCALE
Constant for the action's locale.
|
static String |
PARAMETERS
Constant for the action's parameters.
|
static String |
REQUEST
Constant for the action's session.
|
static String |
SESSION
Constant for the action's session.
|
static String |
TYPE_CONVERTER
Constant for the action's type converter.
|
static String |
VALUE_STACK
Constant for the
OGNL value stack. |
| 构造器和说明 |
|---|
ActionContext(Map context)
Creates a new ActionContext initialized with another context.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
get(Object key)
Returns a value that is stored in the current ActionContext by doing a lookup using the value's key.
|
Map |
getApplication()
Returns a Map of the ServletContext when in a servlet environment or a generic application level Map otherwise.
|
static ActionContext |
getContext()
Returns the ActionContext specific to the current thread.
|
Map |
getContextMap()
Gets the context map.
|
Map |
getConversionErrors()
Gets the map of conversion errors which occurred when executing the action.
|
Locale |
getLocale()
Gets the Locale of the current action.
|
String |
getName()
Gets the name of the current Action.
|
Map |
getParameters()
Returns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of
parameters otherwise.
|
Map |
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(Object key,
Object value)
Stores a value in the current ActionContext.
|
void |
setApplication(Map application)
Sets the action's application context.
|
static void |
setContext(ActionContext context)
Sets the action context for the current thread.
|
void |
setContextMap(Map contextMap)
Sets the action's context map.
|
void |
setConversionErrors(Map conversionErrors)
Sets conversion errors which occurred when executing the action.
|
void |
setLocale(Locale locale)
Sets the Locale for the current action.
|
void |
setName(String name)
Sets the name of the current Action in the ActionContext.
|
void |
setParameters(Map parameters)
Sets the action parameters.
|
void |
setSession(Map session)
Sets a map of action session values.
|
void |
setValueStack(ValueStack stack)
Sets the OGNL value stack.
|
addError, addImport, addImport, addImport, addImport, addImport, addIndexedInput, addIndexedInput, addIndexedInputs, addIndexedLocals, addIndexedLocals, addInput, addInput, addInputs, addPackageImport, addTypeParameters, addVariable, addVariable, addVariables, create, createColoringSubcontext, createSubcontext, declareFunction, getClassLoader, getCompiledExpressionCache, getErrorList, getEvaluationContext, getFunction, getFunctions, getImport, getImports, getIndexedInputs, getIndexedVarNames, getInputs, getInterceptors, getLastLineLabel, getLastTypeParameters, getLineCount, getLineFor, getLineOffset, getParserConfiguration, getProtoImport, getReturnTypeCache, getRootParser, getSourceFile, getStaticImport, getStaticOrClassImport, getTypeParameters, getTypeParametersAsArray, getVariables, getVariableScope, getVarOrInputType, getVarOrInputTypeOrNull, hasFunction, hasFunction, hasImport, hasImports, hasIndexedInputs, hasProtoImport, hasVarOrInput, incrementLineCount, initializeTables, initLineMapping, isAllowBootstrapBypass, isBlockSymbols, isCompiled, isDebugSymbols, isExecutableCodeReached, isFatalError, isFunctionContext, isIndexAllocation, isLineMapped, isOptimizerNotified, isRetainParserState, isStrictTypeEnforcement, isStrongTyping, isVariablesEscape, isVariableVisible, isVisitedLine, makeVisible, optimizationNotify, popVariableScope, processTables, pushVariableScope, setAllowBootstrapBypass, setBlockSymbols, setCompiled, setDebugSymbols, setErrorList, setExecutableCodeReached, setFatalError, setImports, setIndexAllocation, setInputs, setInterceptors, setLastLineLabel, setLastTypeParameters, setLineAndOffset, setLineCount, setLineOffset, setRetainParserState, setRootParser, setSourceFile, setStrictTypeEnforcement, setStrongTyping, setVariables, stronglyTyped, variableIndexOf, visitLine, withImport, withIndexedVars, withInput, withInputs, withTypeParameterspublic static final String ACTION_NAME
public static final String VALUE_STACK
OGNL value stack.public static final String APPLICATION
public static final String TYPE_CONVERTER
public static final String ACTION_INVOCATION
invocation context.public ActionContext(Map context)
context - a context map.public void setApplication(Map application)
application - the action's application context.public Map getApplication()
public static void setContext(ActionContext context)
context - the action context.public static ActionContext getContext()
public void setContextMap(Map contextMap)
contextMap - the context map.public Map getContextMap()
public void setConversionErrors(Map conversionErrors)
conversionErrors - a Map of errors which occurred when executing the action.public Map getConversionErrors()
public void setLocale(Locale locale)
locale - the Locale for the current action.public Locale getLocale()
default locale is used.public void setName(String name)
name - the name of the current action.public String getName()
public void setParameters(Map parameters)
parameters - the parameters for the current action.public Map getParameters()
public void setSession(Map session)
session - the session values.public Map getSession()
public void setValueStack(ValueStack stack)
stack - the OGNL value stack.public ValueStack getValueStack()
public Object get(Object key)
key - the key used to find the value.Copyright © 2023 onecode. All rights reserved.