|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.chain.contexts.ContextWrapper org.apache.struts.chain.contexts.ActionContextBase org.apache.struts.chain.contexts.WebActionContext org.apache.struts.chain.contexts.ServletActionContext
public class ServletActionContext
Implement ActionContext interface while making Servlet API-specific values available.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary |
---|
Fields inherited from class org.apache.struts.chain.contexts.ActionContextBase |
---|
ACTION_CONFIG_KEY, ACTION_FORM_KEY, ACTION_KEY, CANCEL_KEY, ERROR_ACTION_MESSAGES_KEY, EXCEPTION_KEY, FORWARD_CONFIG_KEY, INCLUDE_KEY, LOCALE_KEY, MESSAGE_ACTION_MESSAGES_KEY, MESSAGE_RESOURCES_KEY, MODULE_CONFIG_KEY, token, TOKEN_KEY, TRANSACTION_TOKEN_KEY, VALID_KEY |
Fields inherited from interface org.apache.struts.chain.contexts.ActionContext |
---|
APPLICATION_SCOPE, REQUEST_SCOPE, SESSION_SCOPE |
Constructor Summary | |
---|---|
ServletActionContext(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Instantiate this Context for a given ServletContext, HttpServletRequest, and HttpServletResponse. |
|
ServletActionContext(org.apache.commons.chain.web.servlet.ServletWebContext context)
Instantiate this composite by wrapping a ServletWebContext. |
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. |
ActionServlet |
getActionServlet()
Return the ActionServlet for this context. |
javax.servlet.ServletContext |
getContext()
Return the ServletContext for this context. |
ActionMessages |
getErrors()
Retrieve error messages from an internal cache, creating an empty cache if one is not already present. |
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. |
javax.servlet.http.HttpServletRequest |
getRequest()
Return the HttpServletRequest for this context. |
javax.servlet.http.HttpServletResponse |
getResponse()
Return the HttpServletResponse for this context. |
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 |
saveToken()
Save a new transaction token in the "session" scope for this context, creating new resources, if needed. |
protected org.apache.commons.chain.web.servlet.ServletWebContext |
servletWebContext()
Provide the ServletWebContext for this composite. |
void |
setActionConfig(ActionConfig actionConfig)
Set the ActionConfig class contains the details for processing this request. |
void |
setActionServlet(ActionServlet servlet)
Set the ActionServlet instance for this context. |
void |
setMessageResources(MessageResources resources)
Set the default message resources for the current module. |
void |
setMessageResources(java.lang.String key,
MessageResources resources)
Store the mesasage resources for the current module under the given request attribute key. |
Methods inherited from class org.apache.struts.chain.contexts.WebActionContext |
---|
getApplicationScope, getCancelled, getHeader, getHeaderValues, getInitParam, getModuleConfig, getParam, getParameterMap, getParamValues, getRequestScope, getSessionScope, setCancelled, setModuleConfig, webContext |
Methods inherited from class org.apache.struts.chain.contexts.ActionContextBase |
---|
addActionMessages, findOrCreateActionForm, findOrCreateActionForm, getAction, getActionConfig, getActionForm, getException, getFormValid, getForwardConfig, getInclude, getLocale, getLogger, getScope, getTokenGeneratorId, isTokenValid, saveActionMessages, saveActionMessages, saveMessages, setAction, setActionForm, setException, setFormValid, setForwardConfig, setInclude, setLocale, setLogger |
Methods inherited from class org.apache.struts.chain.contexts.ContextWrapper |
---|
clear, containsKey, containsValue, entrySet, get, getBaseContext, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Constructor Detail |
---|
public ServletActionContext(org.apache.commons.chain.web.servlet.ServletWebContext context)
Instantiate this composite by wrapping a ServletWebContext.
context
- The ServletWebContext to wrappublic ServletActionContext(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Instantiate this Context for a given ServletContext, HttpServletRequest, and HttpServletResponse.
context
- The instant ServletContextrequest
- The instant HttpServletRequestresponse
- The instant HttpServletResponseMethod Detail |
---|
protected org.apache.commons.chain.web.servlet.ServletWebContext servletWebContext()
Provide the ServletWebContext for this composite.
public void release()
ActionContext
release
in interface ActionContext
release
in class WebActionContext
public javax.servlet.ServletContext getContext()
Return the ServletContext for this context.
public javax.servlet.http.HttpServletRequest getRequest()
Return the HttpServletRequest for this context.
public javax.servlet.http.HttpServletResponse getResponse()
Return the HttpServletResponse for this context.
public ActionServlet getActionServlet()
Return the ActionServlet for this context.
public void setActionServlet(ActionServlet servlet)
Set the ActionServlet instance for this context.
servlet
- Our ActionServlet instancepublic void setActionConfig(ActionConfig actionConfig)
ActionContext
Set the ActionConfig class contains the details for processing this request.
setActionConfig
in interface ActionContext
setActionConfig
in class ActionContextBase
actionConfig
- The ActionConfig class to use with this requestpublic MessageResources getMessageResources()
ActionContext
Return the default message resources for the current module.
getMessageResources
in interface ActionContext
getMessageResources
in class ActionContextBase
public MessageResources getMessageResources(java.lang.String key)
ActionContext
Return the specified message resources for the current module.
getMessageResources
in interface ActionContext
getMessageResources
in class ActionContextBase
key
- The key specified in the <message-resources>
element for the requested bundlepublic void setMessageResources(MessageResources resources)
ActionContext
Set the default message resources for the current module.
setMessageResources
in interface ActionContext
setMessageResources
in class ActionContextBase
public void setMessageResources(java.lang.String key, MessageResources resources)
Store the mesasage resources for the current module under the given request attribute key.
key
- Request attribute keyresources
- Message resouces to storepublic void saveErrors(ActionMessages errors)
ActionContext
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.
saveErrors
in interface ActionContext
saveErrors
in class ActionContextBase
errors
- ActionMesssages to cache as errorspublic void saveMessages(ActionMessages messages)
ActionContext
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.
saveMessages
in interface ActionContext
saveMessages
in class ActionContextBase
messages
- ActionMesssages to cachepublic void addMessages(ActionMessages messages)
ActionContext
Append the given messages keys to an internal cache, creating the cache if one is not already present.
addMessages
in interface ActionContext
addMessages
in class ActionContextBase
messages
- New ActionMessages to cachepublic void addErrors(ActionMessages errors)
ActionContext
Append the given errors keys to an internal cache, creating the cache if one is not already present.
addErrors
in interface ActionContext
addErrors
in class ActionContextBase
errors
- New ActionMessages to cache as errorspublic ActionMessages getErrors()
ActionContext
Retrieve error messages from an internal cache, creating an empty cache if one is not already present.
getErrors
in interface ActionContext
getErrors
in class ActionContextBase
public ActionMessages getMessages()
ActionContext
Retrieve messages from an internal cache, creating an empty cache if one is not already present.
getMessages
in interface ActionContext
getMessages
in class ActionContextBase
public void saveToken()
ActionContext
Save a new transaction token in the "session" scope for this context, creating new resources, if needed.
saveToken
in interface ActionContext
saveToken
in class ActionContextBase
public java.lang.String generateToken()
ActionContext
Generate a new transaction token, to be used for enforcing a single request for a particular transaction.
generateToken
in interface ActionContext
generateToken
in class ActionContextBase
public boolean isTokenValid(boolean reset)
ActionContext
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.
isTokenValid
in interface ActionContext
isTokenValid
in class ActionContextBase
reset
- On true, clear the transactional tokenpublic void resetToken()
ActionContext
Clear any transactional token stored in the "session" scope for this context, so that the next check would return false.
resetToken
in interface ActionContext
resetToken
in class ActionContextBase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |