|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectPageFlowManagedObject
FlowController
PageFlowController
public abstract class PageFlowController
Base class for controller logic, exception handlers, and state associated with a particular web directory path.
The class is configured through the
@Jpf.Controller
annotation.
When a page flow request (the page flow URI itself, or any ".do" or page URI in the directory path), arrives, an
instance of the associated PageFlowController class is set as the current page flow, and remains stored in the
session until a different one becomes active ("long lived" page flows stay in the session indefinitely;
see longLived
on @Jpf.Controller
).
The page flow class handles actions that are most commonly raised by user interaction with pages. The actions are handled by action methods or action annotations that determine the next URI to be displayed, after optionally performing arbitrary logic.
If the PageFlowController is a "nested page flow"
(nested
is set to true
on @Jpf.Controller
), then this
is a reusable, modular flow that can be "nested" during other flows. It has entry points (actions with optional form
bean arguments), and exit points (@Jpf.Forward
,
@Jpf.SimpleAction
, or
@Jpf.ConditionalForward
annotations
that have returnAction
attributes).
The page flow class also handles exceptions thrown by actions or during page execution
(see catches
on
@Jpf.Controller
). Unhandled exceptions are
handled in order by declared SharedFlowController
s
(see sharedFlowRefs
on
@Jpf.Controller
).
Properties in the current page flow instance can be accessed from JSP 2.0-style expressions like this one:
${pageFlow.someProperty}
.
There may only be one page flow in any package.
SharedFlowController
,
Serialized FormField Summary |
---|
Fields inherited from class FlowController |
---|
defaultLocale, servlet |
Fields inherited from interface InternalConstants |
---|
ACTION_EXTENSION_LEN, ACTION_OVERRIDE_PREFIX, ANNOTATION_QUALIFIER, ATTR_PREFIX, BACKING_CLASS_IMPLICIT_OBJECT, BEGIN_ACTION_PATH, CURRENT_JPF_ATTR, CURRENT_LONGLIVED_ATTR, FACES_BACKING_ATTR, FACES_BACKING_EXTENSION, FACES_EXTENSION, FACES_EXTENSION_DOT, GLOBALAPP_CLASSNAME, GLOBALAPP_MEMBER_NAME, GLOBALAPP_MODULE_CONTEXT_PATH, INTERNAL_VAR_PREFIX, JSF_EXTENSION, JSF_EXTENSION_DOT, MESSAGE_IS_EXPRESSION_PREFIX, MESSAGE_IS_EXPRESSION_PREFIX_LENGTH, NETUI_CONFIG_PATH, RETURN_ACTION_VIEW_RENDERER_PARAM, RETURNING_FORM_ATTR, RETURNING_FROM_NESTING_ATTR, SHARED_FLOW_ATTR_PREFIX, SHARED_FLOW_EXTENSION, SHARED_FLOW_MODULE_PREFIX, SHARED_FLOW_MODULE_PREFIX_LEN, SHARED_FLOW_ROOT_MODULE, WEBINF_DIR |
Constructor Summary | |
---|---|
protected |
PageFlowController()
Default constructor. |
Method Summary | |
---|---|
void |
create(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext)
This is a framework method for initializing a newly-created page flow, and should not normally be called directly. |
void |
ensureFailover(HttpServletRequest request)
Ensures that any changes to this object will be replicated in a cluster (for failover), even if the replication scheme uses a change-detection algorithm that relies on HttpSession.setAttribute to be aware of changes. |
ActionForward |
exitNesting(HttpServletRequest request,
HttpServletResponse response,
ActionMapping mapping,
ActionForm form)
|
String |
getCurrentForwardPath()
Get the webapp-relative URI for the most recent page (in this page flow) shown to the user. |
PreviousPageInfo |
getCurrentPageInfo()
Get information about the most recent page (in this page flow) shown to the user. |
String |
getDisplayName()
Get the display name of this page flow. |
String |
getModulePath()
Get the Struts module path for this page flow. |
PreviousActionInfo |
getPreviousActionInfo()
Get information about the most recent action run in this page flow. |
protected String |
getPreviousActionURI()
Get the URI for the most recent action in this PageFlowController. |
protected ActionForm |
getPreviousForm()
Deprecated. This method may return an ActionForm wrapper when the form bean type does not extend
ActionForm . Use getPreviousFormBean() instead. |
protected Object |
getPreviousFormBean()
Get the submitted form bean from the most recent action execution in this PageFlowController. |
protected String |
getPreviousForwardPath()
Get the webapp-relative URI for the previous page (in this page flow) shown to the user. |
PreviousPageInfo |
getPreviousPageInfo()
Get information about the previous page (in this page flow) shown to the user. |
PreviousPageInfo |
getPreviousPageInfoLegacy(PageFlowController curJpf,
HttpServletRequest request)
Deprecated. This method will be removed without replacement in the next release. |
SharedFlowController |
getSharedFlow(String sharedFlowName)
Get a shared flow, based on its name as defined in this page flow's sharedFlowRefs
attribute on @Jpf.Controller . |
Map |
getSharedFlows()
Get the a map of shared flow name to shared flow instance. |
protected String |
getTaxonomy()
Get the "resource taxonomy": a period-separated list that starts with the current web application name, continues through all of this PageFlowController's parent directories, and ends with this PageFlowController's class name. |
String |
getURI()
Get the URI for addressing this PageFlowController. |
protected ActionForward |
internalExecute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
An internal method for executing an action; should not be invoked directly. |
protected boolean |
isLongLived()
Tell whether this is a "long lived" page flow. |
protected boolean |
isNestable()
Tell whether this PageFlowController can be "nested", i.e., if it can be invoked from another page flow with the intention of returning to the original one. |
boolean |
isPageFlow()
Tell whether this is a PageFlowController. |
boolean |
isPreviousActionInfoDisabled()
|
boolean |
isPreviousPageInfoDisabled()
|
protected void |
onExitNesting()
Callback that is invoked when this controller instance is exiting nesting (through a return action). |
void |
persistInSession(HttpServletRequest request,
HttpServletResponse response)
Store this object in the user session, in the appropriate place. |
void |
removeFromSession(HttpServletRequest request)
Remove this instance from the session. |
void |
removeSharedFlow(String sharedFlowName)
Remove a shared flow from the session, based on its name as defined in this page flow's sharedFlowRefs
attribute on @Jpf.Controller . |
void |
savePreviousPageInfo(ActionForward forward,
ActionForm form,
ActionMapping mapping,
HttpServletRequest request,
ServletContext servletContext,
boolean isSpecialForward)
Store information about recent pages displayed. |
void |
valueUnbound(HttpSessionBindingEvent event)
Callback when this object is removed from the user session. |
Methods inherited from class PageFlowManagedObject |
---|
fieldIsUninitialized, getCreateTime, getServletContext, initializeField, valueBound |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected PageFlowController()
Method Detail |
---|
public String getModulePath()
getModulePath
in interface ActionResolver
getModulePath
in class FlowController
public String getURI()
getURI
in interface ActionResolver
protected boolean isNestable()
nested
=true
on the
@Jpf.Controller
annotation.
true
if this PageFlowController can be nested.protected boolean isLongLived()
FlowController.remove()
is called. Navigating to another page flow hides
the current long lived controller, but does not remove it.
public void removeFromSession(HttpServletRequest request)
FlowController.remove()
may be called instead.
removeFromSession
in class PageFlowManagedObject
public boolean isPageFlow()
isPageFlow
in interface ActionResolver
isPageFlow
in class FlowController
true
.public void persistInSession(HttpServletRequest request, HttpServletResponse response)
persistInSession
in class PageFlowManagedObject
public void ensureFailover(HttpServletRequest request)
ensureFailover
in class PageFlowManagedObject
request
- the current HttpServletRequestprotected ActionForward internalExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
FlowController
internalExecute
in class FlowController
Exception
public Map getSharedFlows()
SharedFlowController
).public SharedFlowController getSharedFlow(String sharedFlowName)
sharedFlowRefs
attribute on @Jpf.Controller
.
To retrieve any shared flow based on its class name, use PageFlowUtils.getSharedFlow(java.lang.String, javax.servlet.http.HttpServletRequest)
.
sharedFlowName
- the name of the shared flow, as in this page flows's
sharedFlowRefs
attribute on the @Jpf.Controller
annotation.
SharedFlowController
with the given name.public void removeSharedFlow(String sharedFlowName)
sharedFlowRefs
attribute on @Jpf.Controller
.
To remove any shared flow based on its class name, use PageFlowUtils.removeSharedFlow(java.lang.String, javax.servlet.http.HttpServletRequest)
.
sharedFlowName
- the name of the shared flow, as in this page flows's
sharedFlowRefs
attribute on the @Jpf.Controller
annotation.public final void create(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
create
in class FlowController
protected String getTaxonomy()
protected ActionForm getPreviousForm()
ActionForm
wrapper when the form bean type does not extend
ActionForm
. Use getPreviousFormBean()
instead.
Note: if the current page flow does not contain a
@Jpf.Forward
or a
@Jpf.SimpleAction
with
navigateTo=
,
then this method will always return Jpf.NavigateTo.previousAction
null
by default. To enable it in this
situation, add the following method to the page flow:
protected boolean alwaysTrackPreviousAction()
{
return true;
}
null
if there was no form bean submitted.getPreviousPageInfo()
,
getCurrentPageInfo()
,
getPreviousActionInfo()
,
getPreviousActionURI()
,
getPreviousForwardPath()
,
getCurrentForwardPath()
protected Object getPreviousFormBean()
Note: if the current page flow does not contain a
@Jpf.Forward
or a
@Jpf.SimpleAction
with
navigateTo=
,
then this method will always return Jpf.NavigateTo.previousAction
null
by default. To enable it in this
situation, add the following method to the page flow:
protected boolean alwaysTrackPreviousAction()
{
return true;
}
null
if there was no form bean submitted.getPreviousPageInfo()
,
getCurrentPageInfo()
,
getPreviousActionInfo()
,
getPreviousActionURI()
,
getPreviousForwardPath()
,
getCurrentForwardPath()
protected String getPreviousActionURI()
Note: if the current page flow does not use a
@Jpf.Forward
,
@Jpf.SimpleAction
, or
@Jpf.ConditionalForward
with navigateTo=
,
then this method will always return previousAction
null
by default. To enable it in this situation, add the
following method to the page flow:
protected boolean alwaysTrackPreviousAction()
{
return true;
}
getPreviousPageInfo()
,
getCurrentPageInfo()
,
getPreviousActionInfo()
,
getPreviousFormBean()
,
getPreviousForwardPath()
,
getCurrentForwardPath()
public String getCurrentForwardPath()
Note: if the current page flow does not use a
@Jpf.Forward
,
@Jpf.SimpleAction
, or
@Jpf.ConditionalForward
with navigateTo=
or currentPage
navigateTo=
,
then this method will always return previousPage
null
by default. To enable it in this situation, add the
following method to the page flow:
protected boolean alwaysTrackPreviousPage()
{
return true;
}
getPreviousPageInfo()
,
getCurrentPageInfo()
,
getPreviousActionInfo()
,
getPreviousActionURI()
,
getPreviousFormBean()
,
getPreviousForwardPath()
protected String getPreviousForwardPath()
Note: if the current page flow does not use a
@Jpf.Forward
,
@Jpf.SimpleAction
, or
@Jpf.ConditionalForward
with navigateTo=
or currentPage
navigateTo=
,
then this method will always return previousPage
null
by default. To enable it in this situation, add the
following method to the page flow:
protected boolean alwaysTrackPreviousPage()
{
return true;
}
getPreviousPageInfo()
,
getCurrentPageInfo()
,
getPreviousActionInfo()
,
getPreviousActionURI()
,
getPreviousFormBean()
,
getCurrentForwardPath()
public final PreviousPageInfo getPreviousPageInfoLegacy(PageFlowController curJpf, HttpServletRequest request)
getPreviousPageInfoLegacy
in class FlowController
public final PreviousPageInfo getCurrentPageInfo()
Note: if the current page flow does not use a
@Jpf.Forward
,
@Jpf.SimpleAction
, or
@Jpf.ConditionalForward
with navigateTo=
or currentPage
navigateTo=
,
then this method will always return previousPage
null
by default. To enable it in this situation, add the
following method to the page flow:
protected boolean alwaysTrackPreviousPage()
{
return true;
}
getPreviousPageInfo()
,
getPreviousActionInfo()
,
getPreviousActionURI()
,
getPreviousFormBean()
,
getPreviousForwardPath()
,
getCurrentForwardPath()
public final PreviousPageInfo getPreviousPageInfo()
Note: if the current page flow does not use a
@Jpf.Forward
,
@Jpf.SimpleAction
, or
@Jpf.ConditionalForward
with navigateTo=
or currentPage
navigateTo=
,
then this method will always return previousPage
null
by default. To enable it in this situation, add the
following method to the page flow:
getCurrentPageInfo()
,
getPreviousActionInfo()
,
getPreviousActionURI()
,
getPreviousFormBean()
,
getPreviousForwardPath()
,
getCurrentForwardPath()
public final PreviousActionInfo getPreviousActionInfo()
Note: if the current page flow does not use a
@Jpf.Forward
,
@Jpf.SimpleAction
, or
@Jpf.ConditionalForward
with navigateTo=
,
then this method will always return previousAction
null
by default. To enable it in this situation, add the
following method to the page flow:
protected boolean alwaysTrackPreviousAction()
{
return true;
}
getPreviousPageInfo()
,
getCurrentPageInfo()
,
getPreviousActionURI()
,
getPreviousFormBean()
,
getPreviousForwardPath()
,
getCurrentForwardPath()
public String getDisplayName()
getDisplayName
in class PageFlowManagedObject
public boolean isPreviousActionInfoDisabled()
public boolean isPreviousPageInfoDisabled()
public void savePreviousPageInfo(ActionForward forward, ActionForm form, ActionMapping mapping, HttpServletRequest request, ServletContext servletContext, boolean isSpecialForward)
savePreviousPageInfo
in class FlowController
public void valueUnbound(HttpSessionBindingEvent event)
FlowController.onDestroy()
to be called. This is a
framework-invoked method that should not normally be called indirectly.
valueUnbound
in interface HttpSessionBindingListener
valueUnbound
in class PageFlowManagedObject
public ActionForward exitNesting(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping, ActionForm form)
protected void onExitNesting() throws Exception
FlowController.getRequest()
, FlowController.getResponse()
, FlowController.getSession()
may all be used during this method.
Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |