|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.boylesoftware.cb2.presentation.servlet.ActionContext
Represents context of a CB2 action execution within a request processing. A correct instance of this class is always provided to actions and presentation elements.
Field Summary | |
static int |
APPLICATION_SCOPE
Indicates the web-application scope for setAttribute ,
getAttribute and removeAttribute methods. |
static int |
REQUEST_SCOPE
Indicates the HTTP request scope for setAttribute ,
getAttribute and removeAttribute methods. |
static int |
SESSION_SCOPE
Indicates the HTTP session scope for setAttribute ,
getAttribute and removeAttribute methods. |
Constructor Summary | |
ActionContext()
|
Method Summary | |
void |
addComponentRef(java.lang.String refName,
java.lang.String componentName)
Calls addComponentRef(refName, componentName, null) . |
void |
addComponentRef(java.lang.String refName,
java.lang.String componentName,
java.util.Map refAttributes)
Adds a component reference to the list of component references associated with the page, which will be displayed as the result of this request processing. |
void |
addErrors(org.apache.struts.action.ActionErrors errors)
Same as the saveErrors method, but does not overwrite
any existing errors in the request. |
void |
addMessages(org.apache.struts.action.ActionMessages messages)
Same as the saveMessages method, but does not overwrite
any existing messages in the request. |
org.apache.struts.action.ActionForward |
findForward(java.lang.String name)
Convenience method, which calls findForward on the
action mapping in this context. |
org.apache.struts.config.ActionConfig |
findPageMapping(java.lang.String pageName)
Finds action mapping for the named page from pages configuration file. |
org.apache.struts.action.ActionMapping |
getActionMapping()
Gets action mapping used to select the action. |
ApplicationContext |
getApplicationContext()
Gets the application context. |
java.lang.Object |
getAttribute(java.lang.String attrName,
int scope)
Gets an attribute value from the specified scope. |
BLObject |
getBLO(java.lang.String bloName)
Gets the named BLO. |
BLOContainer |
getBLOContainer()
Gets BLO container for the current session. |
java.lang.String |
getBLSessionId()
Finds corresponding BL session id for a request. |
org.apache.struts.action.ActionForm |
getForm()
Gets form bean submitted to the action or null if
no form is required by the action. |
java.util.Locale |
getLocale()
Gets the user's currently selected locale. |
org.apache.commons.logging.Log |
getLog()
Gets log to be used in the action. |
javax.servlet.http.HttpServletRequest |
getRequest()
Gets the HTTP request. |
java.lang.String |
getRequestParameter(java.lang.String paramName)
A shortcut method returning a named HTTP request parameter. |
java.lang.String |
getRequestURL()
Gets complete URL requested by the client browser. |
org.apache.struts.util.MessageResources |
getResources()
Gets the default message resources for the current module. |
org.apache.struts.util.MessageResources |
getResources(java.lang.String key)
Gets the specified message resources for the current module. |
javax.servlet.http.HttpServletResponse |
getResponse()
Gets the HTTP response. |
BLObject |
getSharedBLO(java.lang.String bloName)
Returns the specified by name BLO from the BLManager 's shared BLO container or
null . |
UIState |
getUIState()
Gets the UIState bean instance for the current session. |
void |
removeAttribute(java.lang.String attrName,
int scope)
Removes an attribute from the specified scope. |
void |
saveErrors(org.apache.struts.action.ActionErrors errors)
Save the specified error messages keys into the appropriate request attribute for use by the <html:errors> tag, if any
messages are required. |
void |
saveMessages(org.apache.struts.action.ActionMessages messages)
Save the specified messages keys into the appropriate request attribute for use by the <html:messages> tag
(if messages="true" is set), if any messages are required. |
void |
setAttribute(java.lang.String attrName,
java.lang.Object value,
int scope)
Sets an attribute in the specified scope. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int APPLICATION_SCOPE
setAttribute
,
getAttribute
and removeAttribute
methods.
public static final int SESSION_SCOPE
setAttribute
,
getAttribute
and removeAttribute
methods.
public static final int REQUEST_SCOPE
setAttribute
,
getAttribute
and removeAttribute
methods.
Constructor Detail |
public ActionContext()
Method Detail |
public ApplicationContext getApplicationContext()
public BLObject getSharedBLO(java.lang.String bloName)
BLManager
's shared BLO container or
null
. The BLO names are case-insensitive.
In the most cases you should use the getBLO
method on the BLOContainer
from the action
context, which can return both regular and shared BLOs. This
method is here for those rare cases, when you do not have
access to the BLOContainer
but still need access
to some shared BLOs. Such a situation is possible, for example,
in a detached action.
bloName
- the requested BLO's deployment name,
case-insensitive.
null
.BLOContainer.getBLO(java.lang.String)
public java.lang.String getRequestURL()
public UIState getUIState()
public java.lang.String getBLSessionId()
BLManager
are not the same as the HTTP
session ids assigned by the Servlet Container. This method allows
to find the BL session id for the HTTP request being processed.
public org.apache.struts.action.ActionMapping getActionMapping()
public org.apache.struts.action.ActionForm getForm()
null
if
no form is required by the action.
null
.public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public BLOContainer getBLOContainer()
public org.apache.commons.logging.Log getLog()
public java.util.Locale getLocale()
Action.getLocale
method.
public org.apache.struts.util.MessageResources getResources()
Action.getResources
method.
public org.apache.struts.util.MessageResources getResources(java.lang.String key)
Action.getResources
method.
key
- the key specified in the
<message-resources>
element for the requested bundle.
public void saveErrors(org.apache.struts.action.ActionErrors errors)
<html:errors>
tag, if any
messages are required. Otherwise, ensure that the request attribute
is not created. The same as Struts' Action.saveErrors
method.
errors
- errors to set, null
or empty structure
to clear the errors.public void saveMessages(org.apache.struts.action.ActionMessages messages)
<html:messages>
tag
(if messages="true" is set), if any messages are required. Otherwise,
ensure that the request attribute is not created. The same as Struts'
Action.saveMessages
method.
messages
- messages to set, null
or empty structure
to clear the messages.public BLObject getBLO(java.lang.String bloName)
getBLOContainer().getBLO(bloName)
.
bloName
- the BLO's deployment name.
BLOContainer.getBLO(java.lang.String)
public void addErrors(org.apache.struts.action.ActionErrors errors)
saveErrors
method, but does not overwrite
any existing errors in the request. If there are already some errors
in the request this method will add the specified bundle to them.
errors
- the errors to set/add.public void addMessages(org.apache.struts.action.ActionMessages messages)
saveMessages
method, but does not overwrite
any existing messages in the request. If there are already some messages
in the request this method will add the specified bundle to them.
messages
- the messages to set/add.public org.apache.struts.action.ActionForward findForward(java.lang.String name)
findForward
on the
action mapping in this context.
name
- name of the action forward to find.
public org.apache.struts.config.ActionConfig findPageMapping(java.lang.String pageName)
pageName
- name of the page.
null
if there is no page with the specified name.public java.lang.String getRequestParameter(java.lang.String paramName)
actionCtx.getRequest().getParameter(paramName)
.
paramName
- the HTTP request parameter name.
null
.public java.lang.Object getAttribute(java.lang.String attrName, int scope)
attrName
- name of the attribute to retrieve.scope
- the scope, one of xxx_SCOPE
constants.
null
.public void setAttribute(java.lang.String attrName, java.lang.Object value, int scope)
attrName
- name of the attribute to set.value
- the value to set in the attribute.scope
- the scope, one of xxx_SCOPE
constants.public void removeAttribute(java.lang.String attrName, int scope)
attrName
- name of the attribute to remove.scope
- the scope, one of xxx_SCOPE
constants.public void addComponentRef(java.lang.String refName, java.lang.String componentName) throws javax.servlet.ServletException
addComponentRef(refName, componentName, null)
.
refName
- reference name to be used with the
<cb2:insert>
tag.componentName
- name of the corresponding component as defined
in the pages-config.xml
.
javax.servlet.ServletException
- if no component is defined under the
specified name.addComponentRef(String, String, Map)
public void addComponentRef(java.lang.String refName, java.lang.String componentName, java.util.Map refAttributes) throws javax.servlet.ServletException
<componentref>
elements. This method allows to add
additional component references to the list dynamically from actions,
page pre-actions and presentation elements. Note, that this method
adds a component reference to the end of the list, meaning that all
the corresponding PEs, including any global PEs on which the
component depends, will be initialized after all global and local
PEs required by any components refered by the page statically
via its descriptor, as well as after all PEs required by any
components already added to the list using this method.
refName
- reference name to be used with the
<cb2:insert>
tag.componentName
- name of the corresponding component as defined
in the pages-config.xml
.refAttributes
- component reference attributes, which can be used
with component's presentation elements as input parameters with "from"
attribute set to "crefattribute" or "any". This argument can be
null
.
javax.servlet.ServletException
- if no component is defined under the
specified name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |