|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ActionContext
An ActionContext represents a view of a commons-chain
Context
which encapsulates access to request and
session-scoped resources and services
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
static java.lang.String |
APPLICATION_SCOPE
|
static java.lang.String |
REQUEST_SCOPE
|
static java.lang.String |
SESSION_SCOPE
|
Method Summary | |
---|---|
void |
addErrors(ActionMessages errors)
Append the given errors keys to an internal cache, creating the cache if one is not already present. |
void |
addMessages(ActionMessages messages)
Append the given messages keys to an internal cache, creating the cache if one is not already present. |
java.lang.String |
generateToken()
Generate a new transaction token, to be used for enforcing a single request for a particular transaction. |
Action |
getAction()
Get the action which has been identified to be executed as part of processing this request. |
ActionConfig |
getActionConfig()
Get the ActionConfig which contains the details for processing this request. |
ActionForm |
getActionForm()
Get the ActionForm instance which will carry any data submitted as part of this request. |
java.util.Map |
getApplicationScope()
Return a Map of Application scoped values. |
java.lang.Boolean |
getCancelled()
Indicate if the "cancel event" state is set for for this context, |
ActionMessages |
getErrors()
Retrieve error messages from an internal cache, creating an empty cache if one is not already present. |
java.lang.Exception |
getException()
Retrieve an exception which may have been caught by some code using this ActionContext, usually by an exception handler. |
java.lang.Boolean |
getFormValid()
Is the ActionForm for this context valid? This method does not actually perform form validation. |
ForwardConfig |
getForwardConfig()
Get the ForwardConfig which has been identified as the basis for view-processing. |
java.lang.String |
getInclude()
Get the include path which should be processed as part of processing this request. |
java.util.Locale |
getLocale()
Return the user's currently selected Locale. |
MessageResources |
getMessageResources()
Return the default message resources for the current module. |
MessageResources |
getMessageResources(java.lang.String key)
Return the specified message resources for the current module. |
ActionMessages |
getMessages()
Retrieve messages from an internal cache, creating an empty cache if one is not already present. |
ModuleConfig |
getModuleConfig()
Get the ModuleConfig which is operative for the current request. |
java.util.Map |
getParameterMap()
Return a Map of parameters submitted by the user as
part of this request. |
java.util.Map |
getRequestScope()
Return a Map of request scoped values. |
java.util.Map |
getScope(java.lang.String scopeName)
Return the Map representing the scope identified by scopeName . |
java.util.Map |
getSessionScope()
Return a Map of Session scoped values. |
boolean |
isTokenValid()
Indicate whether a transaction token for this context is valid. |
boolean |
isTokenValid(boolean reset)
Indicate whether a transaction token is stored in the "session" scope for this context, optionally clearing the token, so that the next check would return false. |
void |
release()
Signal to the instance that it will not be used any more, so that any resources which should be cleaned up can be cleaned up. |
void |
resetToken()
Clear any transactional token stored in the "session" scope for this context, so that the next check would return false. |
void |
saveErrors(ActionMessages errors)
Save the given error messages to the internal cache, clearing any previous messages in the cache. |
void |
saveMessages(ActionMessages messages)
Save the given messages to the internal cache, clearing any previous messages in the cache. |
void |
saveMessages(java.lang.String scope,
ActionMessages messages)
Save the given messages to the internal cache, clearing any previous messages in the cache, but only for the specified scope. |
void |
saveToken()
Save a new transaction token in the "session" scope for this context, creating new resources, if needed. |
void |
setAction(Action action)
Set the action which has been identified to be executed as part of processing this request. |
void |
setActionConfig(ActionConfig config)
Set the ActionConfig class contains the details for processing this request. |
void |
setActionForm(ActionForm form)
Set the ActionForm instance which will carry any data submitted as part of this request. |
void |
setCancelled(java.lang.Boolean cancelled)
Set the "cancel event" state for this context. |
void |
setException(java.lang.Exception e)
Store an exception in this context for use by other handling code. |
void |
setFormValid(java.lang.Boolean valid)
Store the result of the validation of the Context's ActionForm. |
void |
setForwardConfig(ForwardConfig forward)
Set the ForwardConfig which should be used as the basis of the view segment of the overall processing. |
void |
setInclude(java.lang.String include)
Set the include path which should be processed as part of processing this request. |
void |
setLocale(java.util.Locale locale)
Set the user's currently selected Locale . |
void |
setMessageResources(MessageResources resources)
Set the default message resources for the current module. |
void |
setModuleConfig(ModuleConfig config)
Set the ModuleConfig which is operative for the current request. |
Methods inherited from interface java.util.Map |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Field Detail |
---|
static final java.lang.String APPLICATION_SCOPE
static final java.lang.String SESSION_SCOPE
static final java.lang.String REQUEST_SCOPE
Method Detail |
---|
void release()
java.util.Map getApplicationScope()
Return a Map
of Application scoped values.
This is implemented in analogy with the Application scope in the Servlet API, but it seems reasonable to expect that any Struts implementation will have an equivalent concept.
The ultimate meaning of "application scope" is an implementation detail left unspecified by Struts.
java.util.Map getSessionScope()
Return a Map
of Session scoped values. A session is
understood as a sequence of requests made by the same user.
This is implemented in analogy with the Session scope in the Servlet API, but it seems reasonable to expect that any Struts implementation will have an equivalent concept.
The ultimate meaning of "session scope" is an implementation detail left unspecified by Struts.
java.util.Map getRequestScope()
Return a Map
of request scoped values. A request is
understood as the fundamental motivation for any particular instance of
an ActionContext
.
This is implemented in analogy with the Request Context in the Servlet API, but it seems reasonable to expect that any Struts implementation will have an equivalent concept.
The ultimate meaning of "request scope" is an implementation detail left unspecified by Struts.
java.util.Map getScope(java.lang.String scopeName)
scopeName
. Implementations should support at minimum the
names associated with the constants APPLICATION_SCOPE
,
SESSION_SCOPE
, and REQUEST_SCOPE
, but are
permitted to support others as well.
scopeName
- A token identifying a scope, including but not limited
to APPLICATION_SCOPE
, SESSION_SCOPE
,
REQUEST_SCOPE
.
java.util.Map getParameterMap()
Return a Map
of parameters submitted by the user as
part of this request. The keys to this map will be request parameter
names (of type String
), and the values will be
String[]
.
This is implemented in analogy with the Request parameters of the Servlet API, but it seems reasonable to expect that any Struts implementation will have an equivalent concept.
void setAction(Action action)
Set the action which has been identified to be executed as part of processing this request.
action
- Action getAction()
Get the action which has been identified to be executed as part of processing this request.
void setActionForm(ActionForm form)
Set the ActionForm instance which will carry any data submitted as part of this request.
form
- The ActionForm instance to use with this requestActionForm getActionForm()
Get the ActionForm instance which will carry any data submitted as part of this request.
void setActionConfig(ActionConfig config)
Set the ActionConfig class contains the details for processing this request.
config
- The ActionConfig class to use with this requestActionConfig getActionConfig()
Get the ActionConfig which contains the details for processing this request.
void setForwardConfig(ForwardConfig forward)
Set the ForwardConfig which should be used as the basis of the view segment of the overall processing. This is the primary method of "communication" with the "view" sub-chain.
forward
- The ForwardConfig to use with this requestForwardConfig getForwardConfig()
Get the ForwardConfig which has been identified as the basis for view-processing.
void setInclude(java.lang.String include)
Set the include path which should be processed as part of processing this request.
include
- The include path to be used with this requestjava.lang.String getInclude()
Get the include path which should be processed as part of processing this request.
void setModuleConfig(ModuleConfig config)
Set the ModuleConfig which is operative for the current request.
config
- The ModuleConfig to be used with this requestModuleConfig getModuleConfig()
Get the ModuleConfig which is operative for the current request.
java.lang.Boolean getFormValid()
Is the ActionForm for this context valid? This method does not actually perform form validation. It is simply a holder property where processes which perform validation can store the results of the validation for other processes' benefit.
Boolean.TRUE
if the form passed validation;
Boolean.FALSE
if the form failed validation; null
if the form has not yet been validatedvoid setFormValid(java.lang.Boolean valid)
Store the result of the validation of the Context's ActionForm.
valid
- Whether the ActionForm for this request passes validationjava.lang.Exception getException()
Retrieve an exception which may have been caught by some code using this ActionContext, usually by an exception handler.
void setException(java.lang.Exception e)
Store an exception in this context for use by other handling code.
e
- An exception to be stored for handling by another membervoid addMessages(ActionMessages messages)
Append the given messages keys to an internal cache, creating the cache if one is not already present.
messages
- New ActionMessages to cachevoid addErrors(ActionMessages errors)
Append the given errors keys to an internal cache, creating the cache if one is not already present.
errors
- New ActionMessages to cache as errorsActionMessages getErrors()
Retrieve error messages from an internal cache, creating an empty cache if one is not already present.
ActionMessages getMessages()
Retrieve messages from an internal cache, creating an empty cache if one is not already present.
void saveErrors(ActionMessages errors)
Save the given error messages to the internal cache, clearing any previous messages in the cache.
If the parameter is null or empty, the internal cache is removed.
errors
- ActionMesssages to cache as errorsvoid saveMessages(ActionMessages messages)
Save the given messages to the internal cache, clearing any previous messages in the cache.
If the parameter is null or empty, the internal cache is removed.
messages
- ActionMesssages to cachevoid saveMessages(java.lang.String scope, ActionMessages messages)
Save the given messages to the internal cache, clearing any previous messages in the cache, but only for the specified scope.
If the parameter is null or empty, the internal cache is removed.
scope
- The scope for the internal cachemessages
- ActionMesssages to cachejava.lang.String generateToken()
Generate a new transaction token, to be used for enforcing a single request for a particular transaction.
boolean isTokenValid()
Indicate whether a transaction token for this context is valid.
A typical implementation will place a transaction token in the session" scope Map and a matching value in the "parameter" Map. If the "session" token does not match the "parameter" attribute, or the session token is missing, then the transactional token is deemed invalid.
boolean isTokenValid(boolean reset)
Indicate whether a transaction token is stored in the "session" scope for this context, optionally clearing the token, so that the next check would return false.
reset
- On true, clear the transactional tokenvoid resetToken()
Clear any transactional token stored in the "session" scope for this context, so that the next check would return false.
void saveToken()
Save a new transaction token in the "session" scope for this context, creating new resources, if needed.
java.lang.Boolean getCancelled()
Indicate if the "cancel event" state is set for for this context,
ActionContextBase.CANCEL_KEY
void setCancelled(java.lang.Boolean cancelled)
Set the "cancel event" state for this context.
cancelled
- On true, set the cancel event state to true. On false,
set the cancel event state to false.ActionContextBase.CANCEL_KEY
MessageResources getMessageResources()
Return the default message resources for the current module.
void setMessageResources(MessageResources resources)
Set the default message resources for the current module.
MessageResources getMessageResources(java.lang.String key)
Return the specified message resources for the current module.
key
- The key specified in the <message-resources>
element for the requested bundlejava.util.Locale getLocale()
Return the user's currently selected Locale.
void setLocale(java.util.Locale locale)
Set the user's currently selected Locale
.
locale
- The user's selected Locale to be set, or null to select
the server's default Locale
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |