|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectPageFlowManagedObject
FlowController
public abstract class FlowController
Base class for user-written flow controllers - PageFlowController
s and SharedFlowController
s.
Field Summary | |
---|---|
protected static Locale |
defaultLocale
Deprecated. Use getDefaultLocale() . |
protected ActionServlet |
servlet
Deprecated. This variable will be removed with no replacement. In most cases, PageFlowManagedObject.getServletContext() is sufficient; for other cases, the ActionServlet itself
is in the ServletContext attribute Globals.ACTION_SERVLET_KEY . |
Constructor Summary | |
---|---|
protected |
FlowController()
Default constructor. |
Method Summary | |
---|---|
void |
addActionError(String propertyName,
String messageKey,
Object... messageArgs)
Add a property-related message that will be shown with the Errors and Error tags. |
void |
addActionErrorExpression(String propertyName,
String expression,
Object... messageArgs)
Add a property-related message as an expression that will be evaluated and shown with the Errors and Error tags. |
protected void |
addValidationError(String propertyName,
String messageKey)
Deprecated. Use addActionError(java.lang.String, java.lang.String, java.lang.Object...) instead. |
protected void |
addValidationError(String propertyName,
String messageKey,
Object[] messageArgs)
Deprecated. Use addActionError(java.lang.String, java.lang.String, java.lang.Object...) instead. |
protected void |
afterAction()
Callback that occurs after any user action method is invoked. |
protected boolean |
alwaysTrackPreviousAction()
When this FlowController does not use a Jpf.Forward annotation with a
navigateTo =Jpf.NavigateTo.previousAction attribute, the following methods always return
null by default. |
protected boolean |
alwaysTrackPreviousPage()
When this FlowController does not use a Jpf.Forward annotation with either a
navigateTo =Jpf.NavigateTo.currentPage attribute or a
navigateTo =Jpf.NavigateTo.previousPage attribute, the following methods always return
null by default. |
protected void |
beforeAction()
Callback that occurs before any user action method is invoked. |
void |
create(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext)
Initialize. |
ActionForward |
execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
Perform decision logic to determine the next URI to be displayed. |
protected String |
generateToken()
Generate a new transaction token, to be used for enforcing a single request for a particular transaction. |
protected String |
generateToken(HttpServletRequest request)
Deprecated. Use generateToken() instead. |
protected ActionMapping |
getActionMapping()
Get the current Struts ActionMapping, which is information from the Struts-XML <action> tag that corresponds to the current action being executed. |
protected Method |
getActionMethod(String methodName,
Class argType)
Get an action handler method of the given name/signature . |
String[] |
getActions()
Get a list of the names of actions handled by methods in this PageFlowController. |
MutableURI |
getActionURI(String actionName)
Create a raw action URI, which can be modified before being sent through the registered URL rewriting chain using URLRewriterService.rewriteURL(javax.servlet.ServletContext, javax.servlet.ServletRequest, javax.servlet.ServletResponse, org.apache.beehive.netui.core.urls.MutableURI, org.apache.beehive.netui.core.urls.URLRewriter.URLType, boolean) . |
protected String |
getCurrentActionName()
Get the name of the current action being executed. |
protected DataSource |
getDataSource(HttpServletRequest request)
Return the default data source for the Struts module associated with this FlowController. |
protected DataSource |
getDataSource(HttpServletRequest request,
String key)
Return the specified data source for the current Struts module. |
protected static Locale |
getDefaultLocale()
Get the system default locale. |
ActionForm |
getFormBean(ActionMapping mapping)
Get the flow-scoped form bean member associated with the given ActionMapping. |
protected Locale |
getLocale()
Get the user's currently selected Locale. |
protected Locale |
getLocale(HttpServletRequest request)
Deprecated. Use getLocale(javax.servlet.http.HttpServletRequest) or retrieveUserLocale(javax.servlet.http.HttpServletRequest, java.lang.String) . |
protected ActionMapping |
getMapping()
Deprecated. Use getActionMapping() instead. |
protected MessageResources |
getMessageResources()
Get the default message resources for this FlowController. |
protected MessageResources |
getMessageResources(String key)
Get the specified message resources for this FlowController. |
ModuleConfig |
getModuleConfig()
|
ModuleConfig |
getModuleConfig(ServletContext servletContext,
HttpServletRequest request)
Gets the Struts module configuration associated with this controller. |
abstract String |
getModulePath()
Get the Struts module path for this controller. |
abstract PreviousPageInfo |
getPreviousPageInfoLegacy(PageFlowController curJpf,
HttpServletRequest request)
Deprecated. This method will be removed without replacement in a future release. |
protected HttpServletRequest |
getRequest()
Get the current HttpServletRequest. |
protected MessageResources |
getResources()
Deprecated. This method can only return the resources for the default module. Use getMessageResources() to get the
resources for this FlowController. |
protected MessageResources |
getResources(HttpServletRequest request)
Deprecated. Use getMessageResources() instead. |
protected MessageResources |
getResources(HttpServletRequest request,
String key)
Deprecated. Use getMessageResources(String) instead. |
protected HttpServletResponse |
getResponse()
Get the current HttpServletResponse. |
String |
getRewrittenActionURI(String actionName,
Map parameters,
boolean asValidXml)
Create a fully-rewritten URI given an action and parameters. |
protected ActionServlet |
getServlet()
Deprecated. This method will be removed with no replacement. In most cases, PageFlowManagedObject.getServletContext() is
sufficient; for other cases, the ActionServlet itself is in the ServletContext attribute
Globals.ACTION_SERVLET_KEY . |
protected HttpSession |
getSession()
Get the current user session. |
ActionForward |
handleException(Throwable ex,
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
Handle the given exception - invoke user code if appropriate and return a destination URI. |
protected ActionForward |
internalExecute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
|
protected ActionForward |
invokeActionMethod(Method method,
Object arg)
Invoke the given action handler method, passing it an argument if appropriate. |
ActionForward |
invokeExceptionHandler(Method method,
Throwable ex,
String message,
Object formBean,
ActionForm wrappedFormBean,
ActionMapping actionMapping,
HttpServletRequest request,
HttpServletResponse response,
boolean readonly)
Invoke the given exception handler method. |
boolean |
isAction(String name)
Tell whether a given String is the name of an action handled by a method in this PageFlowController. |
protected boolean |
isCancelled(HttpServletRequest request)
Deprecated. This method will be removed without replacement in a future release. The normal method for cancelling in a form is to use the action attribute on
Button , rather than avoiding validation on the current action. |
boolean |
isPageFlow()
Tell whether this is a PageFlowController . |
protected boolean |
isTokenValid()
Return true if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. |
protected boolean |
isTokenValid(boolean reset)
Return true if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. |
protected boolean |
isTokenValid(HttpServletRequest request)
Deprecated. Use isTokenValid() instead. |
protected boolean |
isTokenValid(HttpServletRequest request,
boolean reset)
Deprecated. Use isTokenValid(boolean) instead. |
void |
login(String username,
String password)
Log in the user, using "weak" username/password authentication. |
void |
logout(boolean invalidateSessions)
Log out the current user. |
static ActionResult |
lookup(String actionName,
ServletContext context,
HttpServletRequest request,
HttpServletResponse response)
Deprecated. Use PageFlowUtils.strutsLookup(javax.servlet.ServletContext, javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String[]) instead. This method will be removed in v1.1. |
static ActionResult |
lookup(String actionName,
ServletContext context,
HttpServletRequest request,
HttpServletResponse response,
String actionServletClassName)
Deprecated. Use PageFlowUtils.strutsLookup(javax.servlet.ServletContext, javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String[]) instead. This method will be removed in v1.1. |
protected void |
onCreate()
Callback that is invoked when this controller instance is created. |
protected void |
onDestroy()
Deprecated. onDestroy(HttpSession) should be used instead. |
protected void |
onDestroy(HttpSession session)
Callback that is invoked when this controller instance is "destroyed", i.e., removed from the user session. |
protected void |
onRefresh()
Callback that is invoked when this controller is involved in a refresh request, as can happen in a portal environment on a request where no action is run in the current page flow, but a previously-displayed JSP in the page flow is re-rendered. |
void |
refresh(HttpServletRequest request,
HttpServletResponse response)
Called on this object for non-lookup (refresh) requests. |
void |
reinitialize(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext)
Initialize transient data that may have been lost during session failover. |
protected void |
remove()
Remove this instance from the user session. |
protected void |
resetToken()
Reset the saved transaction token in the user's session. |
protected void |
resetToken(HttpServletRequest request)
Deprecated. Use resetToken() instead. |
String |
resolveAction(String actionName,
Object form)
Deprecated. Use resolveAction(String, Object, HttpServletRequest, HttpServletResponse) instead. |
String |
resolveAction(String actionName,
Object form,
HttpServletRequest request,
HttpServletResponse response)
Call an action and return the result URI. |
static Locale |
retrieveUserLocale(HttpServletRequest request,
String locale)
|
protected void |
saveActionErrors(ActionMessages errors)
Save the specified messages keys into the request for use by the <netui:error> or <netui:errors> tags. |
protected void |
saveErrors(HttpServletRequest request,
ActionMessages errors)
Deprecated. Use saveActionErrors(org.apache.struts.action.ActionMessages) instead. |
protected void |
saveMessages(HttpServletRequest request,
ActionMessages messages)
Deprecated. This method will be removed without replacement in a future release. |
void |
savePreviousPageInfo(ActionForward forward,
ActionForm form,
ActionMapping mapping,
HttpServletRequest request,
ServletContext servletContext,
boolean isSpecialForward)
Store information about recent pages displayed. |
protected void |
saveToken(HttpServletRequest request)
Save a new transaction token in the user's current session, creating a new session if necessary. |
protected void |
sendError(String errText,
HttpServletRequest request,
HttpServletResponse response)
Send a Page Flow error to the browser. |
protected void |
sendError(String errText,
HttpServletResponse response)
Deprecated. Use sendError(String, HttpServletRequest, HttpServletResponse) instead. |
protected void |
setLocale(HttpServletRequest request,
Locale locale)
Deprecated. Use setLocale(Locale) . |
protected void |
setLocale(Locale locale)
Deprecated. Use setLocale(Locale) . |
Methods inherited from class PageFlowManagedObject |
---|
ensureFailover, fieldIsUninitialized, getDisplayName, getServletContext, initializeField, persistInSession, removeFromSession, valueBound, valueUnbound |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ActionResolver |
---|
getURI |
Field Detail |
---|
protected static Locale defaultLocale
getDefaultLocale()
.
protected transient ActionServlet servlet
PageFlowManagedObject.getServletContext()
is sufficient; for other cases, the ActionServlet itself
is in the ServletContext attribute Globals.ACTION_SERVLET_KEY
.
Constructor Detail |
---|
protected FlowController()
Method Detail |
---|
public void reinitialize(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
PageFlowManagedObject
reinitialize
in class PageFlowManagedObject
public void login(String username, String password) throws LoginException
username
- the user's login namepassword
- the user's password
LoginException
- if the authentication failedpublic void logout(boolean invalidateSessions)
invalidateSessions
- if true, the session is invalidated (on all single-signon webapps);
otherwise the session and its data are left intact (except for authentication
information used internally by the server). To invalidate the session in only the
current webapp, set this parameter to false
and call
getSession()
.invalidate().protected void sendError(String errText, HttpServletResponse response) throws IOException
sendError(String, HttpServletRequest, HttpServletResponse)
instead.
errText
- the error message to display.response
- the current HttpServletResponse.
IOException
protected void sendError(String errText, HttpServletRequest request, HttpServletResponse response) throws IOException
errText
- the error message to display.response
- the current HttpServletResponse.
IOException
public ActionForward handleException(Throwable ex, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
ex
- the Exception to handle.mapping
- the Struts action mapping for current Struts action being processed.form
- the form-bean (if any) associated with the Struts action being processed. May be null.request
- the current HttpServletRequest.response
- the current HttpServletResponse.
ServletException
- if another Exception is thrown during handling of ex
.
IOException
protected String getCurrentActionName()
execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
(where any user action method is invoked), and during the lifecycle
methods beforeAction()
and afterAction()
.
IllegalStateException
- if this method is invoked outside of action method
execution (i.e., outside of the call to execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
, and outside of
onCreate()
, beforeAction()
, afterAction()
.public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
mapping
- the Struts ActionMapping for the current action being processed.form
- the form-bean (if any) associated with the Struts action being processed. May be null.request
- the current HttpServletRequest.response
- the current HttpServletResponse.
Exception
- if an Exception was thrown during user action-handling code.protected ActionForward internalExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
Exception
public void create(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
PageFlowManagedObject
create
in class PageFlowManagedObject
public abstract String getModulePath()
getModulePath
in interface ActionResolver
PageFlowController
and "/-global" for Global.app.protected void beforeAction() throws Exception
getRequest()
,
getResponse()
, getSession()
, and getActionMapping()
may all be used
during this method. The action to be run can be discovered by calling
ActionConfig.getPath()
on the value returned from getActionMapping()
.
Exception
protected void afterAction() throws Exception
getRequest()
,
getResponse()
, getSession()
, and getActionMapping()
may all be used
during this method. The action that was run can be discovered by calling
ActionConfig.getPath()
on the value returned from getActionMapping()
.
Exception
protected void onCreate() throws Exception
getRequest()
,
getResponse()
, getSession()
may all be used during this method.
onCreate
in class PageFlowManagedObject
Exception
protected void onDestroy()
onDestroy(HttpSession)
should be used instead.
getRequest()
, getResponse()
, and getActionMapping()
may not
be used during this method, since it may be called due to session termination outside of a
request. getSession()
also may not be used, but the session is passed as an argument
to onDestroy(HttpSession)
, which should be used in place of this
method.
protected void onDestroy(HttpSession session)
getRequest()
, getResponse()
, and getActionMapping()
may not
be used during this method, since it may be called due to session termination outside of a
request. getSession()
also may not be used, but the session is passed as an argument.
onDestroy
in class PageFlowManagedObject
public abstract PreviousPageInfo getPreviousPageInfoLegacy(PageFlowController curJpf, HttpServletRequest request)
protected Method getActionMethod(String methodName, Class argType)
methodName
- the name of the action handler method to query.argType
- the type of the argument to the action handler method; if null
,
the method takes no arguments.
null
if it doesn't exist.protected ActionForward invokeActionMethod(Method method, Object arg) throws Exception
method
- the action handler method to invoke.arg
- the form-bean to pass; may be null
.
Exception
- if an Exception was raised in user code.protected final HttpServletRequest getRequest()
execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
(where
any user action method is invoked), and during the lifecycle methods onCreate()
,
beforeAction()
, afterAction()
.
IllegalStateException
- if this method is invoked outside of action method
execution (i.e., outside of the call to execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
, and outside of
onCreate()
, beforeAction()
, afterAction()
.protected final HttpServletResponse getResponse()
execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
(where
any user action method is invoked), and during the lifecycle methods onCreate()
,
beforeAction()
, afterAction()
.
IllegalStateException
- if this method is invoked outside of action method
execution (i.e., outside of the call to execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
, and outside of
onCreate()
, beforeAction()
, afterAction()
.protected final ActionMapping getMapping()
getActionMapping()
instead.
execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
(where any user action method is invoked), and during the lifecycle
methods beforeAction()
and afterAction()
.
IllegalStateException
- if this method is invoked outside of action method
execution (i.e., outside of the call to execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
, and outside of
onCreate()
, beforeAction()
, afterAction()
.protected final ActionMapping getActionMapping()
execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
(where any user action method is invoked), and during the lifecycle
methods beforeAction()
and afterAction()
.
IllegalStateException
- if this method is invoked outside of action method
execution (i.e., outside of the call to execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
, and outside of
onCreate()
, beforeAction()
, afterAction()
.protected final HttpSession getSession()
execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
(where
any user action method is invoked), and during the lifecycle methods onCreate()
,
onDestroy()
, beforeAction()
, afterAction()
.
IllegalStateException
- if this method is invoked outside of action method
execution (i.e., outside of the call to execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
, and outside of
onCreate()
, onDestroy()
, beforeAction()
, afterAction()
.public final ModuleConfig getModuleConfig()
public ModuleConfig getModuleConfig(ServletContext servletContext, HttpServletRequest request)
servletContext
- the current ServletContext.
public static ActionResult lookup(String actionName, ServletContext context, HttpServletRequest request, HttpServletResponse response) throws Exception
PageFlowUtils.strutsLookup(javax.servlet.ServletContext, javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String[])
instead. This method will be removed in v1.1.
PageFlowActionServlet
.
Note: this method invokes the full action-processing cycle on a ScopedRequest
. Use
resolveAction(java.lang.String, java.lang.Object, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
to resolve the URI for an action in the current page flow.
Exception
public static ActionResult lookup(String actionName, ServletContext context, HttpServletRequest request, HttpServletResponse response, String actionServletClassName) throws Exception
PageFlowUtils.strutsLookup(javax.servlet.ServletContext, javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String[])
instead. This method will be removed in v1.1.
ScopedRequest
. Use
resolveAction(java.lang.String, java.lang.Object, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
to resolve the URI for an action in the current page flow.
Exception
public String resolveAction(String actionName, Object form, HttpServletRequest request, HttpServletResponse response) throws Exception
actionName
- the name of the action to run.form
- the form bean instance to pass to the action, or null
if none should be passed.
ActionNotFoundException
- when the given action does not exist in this FlowController.
Exception
- if the action method throws an Exception.public String resolveAction(String actionName, Object form) throws Exception
resolveAction(String, Object, HttpServletRequest, HttpServletResponse)
instead.
actionName
- the name of the action to run.form
- the form bean instance to pass to the action, or null
if none should be passed.
ActionNotFoundException
- when the given action does not exist in this FlowController.
Exception
- if the action method throws an Exception.public String[] getActions()
public boolean isAction(String name)
name
- the action-name to query.
true
if name
is the name of an action handled by a method in this
PageFlowController.public boolean isPageFlow()
PageFlowController
.
isPageFlow
in interface ActionResolver
true
if this is a PageFlowController
.protected ActionServlet getServlet()
PageFlowManagedObject.getServletContext()
is
sufficient; for other cases, the ActionServlet itself is in the ServletContext attribute
Globals.ACTION_SERVLET_KEY
.
public final void refresh(HttpServletRequest request, HttpServletResponse response)
refresh
in interface ActionResolver
protected void onRefresh()
protected void remove()
public void savePreviousPageInfo(ActionForward forward, ActionForm form, ActionMapping mapping, HttpServletRequest request, ServletContext servletContext, boolean isSpecialForward)
protected boolean alwaysTrackPreviousAction()
Jpf.Forward
annotation with a
navigateTo
=Jpf.NavigateTo.previousAction
attribute, the following methods always return
null
by default.
alwaysTrackPreviousAction
(which always returns false
)
to enable these methods in all cases.
true
if the previous action should always be tracked, regardless
of whether return-to="previousAction"
is used.PageFlowController.getPreviousActionInfo()
,
PageFlowController.getPreviousActionURI()
,
PageFlowController.getPreviousFormBean()
protected boolean alwaysTrackPreviousPage()
Jpf.Forward
annotation with either a
navigateTo
=Jpf.NavigateTo.currentPage
attribute or a
navigateTo
=Jpf.NavigateTo.previousPage
attribute, the following methods always return
null
by default.
alwaysTrackPreviousPage
(which always returns false
)
to enable these methods in all cases.
true
if the previous page should always be tracked, regardless
of whether return-to="currentPage"
or return-to="previousPage"
is used.PageFlowController.getCurrentPageInfo()
,
PageFlowController.getPreviousPageInfo()
,
PageFlowController.getCurrentForwardPath()
,
PageFlowController.getPreviousForwardPath()
public ActionForward invokeExceptionHandler(Method method, Throwable ex, String message, Object formBean, ActionForm wrappedFormBean, ActionMapping actionMapping, HttpServletRequest request, HttpServletResponse response, boolean readonly) throws IOException, ServletException
method
- the action handler method to invoke.ex
- the Throwable that is to be handled.message
- the String message that is to be passed to the handler method.formBean
- the form bean that is associated with the action being processed; may be
null
.request
- the current HttpServletRequest.response
- the current HttpServletResponse.readonly
- if true
, session failover will not be triggered after invoking the method.
IOException
ServletException
public void addActionError(String propertyName, String messageKey, Object... messageArgs)
propertyName
- the name of the property with which to associate this error.messageKey
- the message-resources key for the message.messageArgs
- zero or more arguments to the message.public void addActionErrorExpression(String propertyName, String expression, Object... messageArgs)
propertyName
- the name of the property with which to associate this error.expression
- the expression that will be evaluated to generate the error message.messageArgs
- zero or more arguments to the message.protected void addValidationError(String propertyName, String messageKey, Object[] messageArgs)
addActionError(java.lang.String, java.lang.String, java.lang.Object...)
instead.
propertyName
- the name of the property with which to associate this error.messageKey
- the message-resources key for the error message.messageArgs
- an array of arguments for the error message.protected void addValidationError(String propertyName, String messageKey)
addActionError(java.lang.String, java.lang.String, java.lang.Object...)
instead.
propertyName
- the name of the property with which to associate this error.messageKey
- the message-resources key for the error message.protected static Locale getDefaultLocale()
protected DataSource getDataSource(HttpServletRequest request)
request
- the current request.protected DataSource getDataSource(HttpServletRequest request, String key)
request
- The servlet request we are processingkey
- The key specified in the
<message-resources>
element for the
requested bundleprotected Locale getLocale(HttpServletRequest request)
getLocale(javax.servlet.http.HttpServletRequest)
or retrieveUserLocale(javax.servlet.http.HttpServletRequest, java.lang.String)
.
request
- the current request.
protected Locale getLocale()
public static Locale retrieveUserLocale(HttpServletRequest request, String locale)
protected MessageResources getResources()
getMessageResources()
to get the
resources for this FlowController.
protected MessageResources getResources(HttpServletRequest request)
getMessageResources()
instead.
request
- The servlet request we are processingprotected MessageResources getResources(HttpServletRequest request, String key)
getMessageResources(String)
instead.
request
- the current request.key
- The bundle key specified in a
Jpf.MessageBundle
annotation.protected MessageResources getMessageResources()
protected MessageResources getMessageResources(String key)
key
- The bundle key specified in a Jpf.MessageBundle
annotation.protected boolean isCancelled(HttpServletRequest request)
action
attribute on
Button
, rather than avoiding validation on the current action.
Returns true
if the current form's cancel button was
pressed. This method will check if the Globals.CANCEL_KEY
request attribute has been set, which normally occurs if the cancel
button generated by the Struts CancelTag was pressed by the user
in the current request. If true
, validation performed
by an ActionForm's validate()
method
will have been skipped by the controller servlet.
request
- The servlet request we are processingCancelTag
protected String generateToken(HttpServletRequest request)
generateToken()
instead.
request
- the current request.protected String generateToken()
isTokenValid()
,
isTokenValid(boolean)
,
resetToken()
protected boolean isTokenValid(HttpServletRequest request)
isTokenValid()
instead.
true
if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. Returns false
under any of the following circumstances:
request
- The servlet request we are processingprotected boolean isTokenValid()
true
if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. Returns false
under any of the following circumstances:
generateToken()
,
resetToken()
protected boolean isTokenValid(HttpServletRequest request, boolean reset)
isTokenValid(boolean)
instead.
true
if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. Returns false
request
- The servlet request we are processingreset
- Should we reset the token after checking it?protected boolean isTokenValid(boolean reset)
true
if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. Returns false
reset
- Should we reset the token after checking it?generateToken()
,
resetToken()
protected void resetToken(HttpServletRequest request)
resetToken()
instead.
request
- The servlet request we are processingprotected void resetToken()
isTokenValid()
,
isTokenValid(boolean)
,
generateToken()
protected void saveErrors(HttpServletRequest request, ActionMessages errors)
saveActionErrors(org.apache.struts.action.ActionMessages)
instead.
errors
- the ActionMessages to save in the request.protected void saveMessages(HttpServletRequest request, ActionMessages messages)
request
- The servlet request we are processingmessages
- Messages objectprotected void saveActionErrors(ActionMessages errors)
errors
- the ActionMessages to save in the request.protected void saveToken(HttpServletRequest request)
request
- The servlet request we are processingprotected void setLocale(HttpServletRequest request, Locale locale)
setLocale(Locale)
.
request
- The request we are processinglocale
- The user's selected Locale to be set, or null
to select the server's default Localeprotected void setLocale(Locale locale)
setLocale(Locale)
.
locale
- The user's selected Locale to be set, or null to select the server's default Localepublic ActionForm getFormBean(ActionMapping mapping)
public MutableURI getActionURI(String actionName) throws URISyntaxException
URLRewriterService.rewriteURL(javax.servlet.ServletContext, javax.servlet.ServletRequest, javax.servlet.ServletResponse, org.apache.beehive.netui.core.urls.MutableURI, org.apache.beehive.netui.core.urls.URLRewriter.URLType, boolean)
.
actionName
- the action name to convert into a MutableURI.
URISyntaxException
- if there is a problem converting the action URI (derived
from processing the given action name) into a MutableURI.
IllegalStateException
- if this method is invoked outside of action method
execution (i.e., outside of the call to execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
,
and outside of onCreate()
,
beforeAction()
, afterAction()
.public String getRewrittenActionURI(String actionName, Map parameters, boolean asValidXml) throws URISyntaxException
actionName
- the action name to convert into a fully-rewritten URI.parameters
- the additional parameters to include in the URI query.asValidXml
- flag indicating that the query of the uri should be written
using the "&" entity, rather than the character, '&'.
URISyntaxException
- if there is a problem converting the action url (derived
from processing the given action name) into a URI.
IllegalStateException
- if this method is invoked outside of action method
execution (i.e., outside of the call to execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
,
and outside of onCreate()
,
beforeAction()
, afterAction()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |