org.apache.beehive.netui.pageflow
Class PageFlowController

Object
  extended by PageFlowManagedObject
      extended by FlowController
          extended by PageFlowController
All Implemented Interfaces:
Serializable, EventListener, HttpSessionBindingListener, ActionResolver, PageFlowConstants

public abstract class PageFlowController
extends FlowController

Base class for user-defined state and controller logic associated with a particular web application directory. The source code for this class lives in the directory with a ".jpf" extension, and is automatically recompiled by the server whenever necessary. When a request arrives for any ".jpf", ".jsp", or ".do" in the directory, an instance of the PageFlowController class is set as the current page flow, and remains in the session until a different one becomes active.

The user's PageFlowController class handles actions that are most commonly raised by user interaction with JSP files. The actions are handled by action methods that perform arbitrary logic and determine the next URI to be displayed.

Actions that are not handled by the current PageFlowController "bubble" up to the appropriate SharedFlowController instance.

Data in the current PageFlowController instance can be accessed by databinding tags using the pageFlow scope.

See Also:
SharedFlowController, Serialized Form

Field Summary
 
Fields inherited from class FlowController
defaultLocale, servlet
 
Fields inherited from interface PageFlowConstants
ACTION_EXTENSION, ACTION_OVERRIDE, BEGIN_ACTION_NAME, DEFAULT_FORWARD_OVERFLOW_COUNT, DEFAULT_NESTING_OVERFLOW_COUNT, FORWARD_OVERFLOW_COUNT_PARAM, GLOBALAPP_CLASSNAME, GLOBALAPP_SOURCEFILE_NAME, HTTP_REDIRECTOR_PARAM, JPF_EXTENSION, JPF_MODULE_CONFIG_EXTENSION, JPF_MODULE_CONFIG_GEN_DIR, JPF_MODULE_CONFIG_PREFIX, LOGIN_HANDLER_PARAM, NESTING_OVERFLOW_COUNT_PARAM, SECURE_FORWARDS_PARAM
 
Constructor Summary
protected PageFlowController()
          Default constructor.
 
Method Summary
protected  void deleteFromSession(HttpServletRequest request)
          Remove this instance from the session.
 void ensureFailover(HttpServletRequest request)
          Ensures that any changes to this FlowController 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.
protected  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()
           
 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()
          Get the form instance 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.
protected  SharedFlowController getSharedFlow()
           
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)
           
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.
protected  boolean isSingleton()
          Tell whether this is a "singleton" page flow.
 void valueUnbound(HttpSessionBindingEvent event)
          Callback when this page flow is removed from the user session.
 
Methods inherited from class FlowController
addValidationError, addValidationError, afterAction, alwaysTrackPreviousAction, alwaysTrackPreviousPage, beforeAction, delete, execute, generateToken, getActionMapping, getActionMethod, getActions, getCurrentActionName, getDataSource, getDataSource, getDefaultLocale, getLocale, getLocale, getMapping, getModuleConfig, getModuleConfig, getRequest, getResources, getResources, getResources, getResponse, getServlet, getSession, handleException, invokeActionMethod, invokeExceptionHandler, isAction, isCancelled, isTokenValid, isTokenValid, login, logout, lookup, lookup, onCreate, onDestroy, onDestroy, onRefresh, refresh, reinitialize, resetToken, resolveAction, resolveAction, retrieveUserLocale, saveErrors, saveMessages, saveToken, sendError, sendError, setLocale, setLocale
 
Methods inherited from class PageFlowManagedObject
fieldIsUninitialized, getServletContext, initializeField, valueBound
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageFlowController

protected PageFlowController()
Default constructor.

Method Detail

getModulePath

public String getModulePath()
Get the Struts module path for this page flow.

Specified by:
getModulePath in interface ActionResolver
Specified by:
getModulePath in class FlowController
Returns:
a String that is the Struts module path for this controller, and which is also the directory path from the web application root to this PageFlowController (not including the action filename).

getURI

public String getURI()
Get the URI for addressing this PageFlowController.

Returns:
a String that is the URI which will execute the begin action on this PageFlowController.

isNestable

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. Page flows are declared to be nested using the @jpf:controller nested="true" annotation.

Overrides:
isNestable in class FlowController
Returns:
true if this PageFlowController can be nested.

isSingleton

protected boolean isSingleton()
Tell whether this is a "singleton" page flow. Once it is invoked, a singleton page flow is never removed from the session unless FlowController.delete() is called. Navigating to another page flow hides the current singleton controller, but does not remove it.

Overrides:
isSingleton in class FlowController

deleteFromSession

protected void deleteFromSession(HttpServletRequest request)
Remove this instance from the session.

Specified by:
deleteFromSession in class PageFlowManagedObject

isPageFlow

public boolean isPageFlow()
Tell whether this is a PageFlowController.

Specified by:
isPageFlow in interface ActionResolver
Overrides:
isPageFlow in class FlowController
Returns:
true.

ensureFailover

public void ensureFailover(HttpServletRequest request)
Ensures that any changes to this FlowController 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.

Specified by:
ensureFailover in class PageFlowManagedObject
Parameters:
request - the current HttpServletRequest

internalExecute

protected ActionForward internalExecute(ActionMapping mapping,
                                        ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response)
                                 throws Exception
Overrides:
internalExecute in class FlowController
Throws:
Exception

getSharedFlow

protected SharedFlowController getSharedFlow()

getTaxonomy

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.


getPreviousForm

protected ActionForm getPreviousForm()
Get the form instance from the most recent action execution in this PageFlowController.

Note: if the current page flow does not use a @jpf:forward with a return-to="previousAction" attribute, then this method will always return null by default. To enable it in this situation, add the following method to the page flow:

protected boolean alwaysTrackPreviousAction()
{
    return true;
}

Returns:
the ActionForm instance from the most recent action execution, or null if there was no ActionForm instance.
See Also:
getPreviousPageInfo(), getCurrentPageInfo(), getPreviousActionInfo(), getPreviousActionURI(), getPreviousForwardPath(), getCurrentForwardPath()

getPreviousActionURI

protected String getPreviousActionURI()
Get the URI for the most recent action in this PageFlowController.

Note: if the current page flow does not use a @jpf:forward with a return-to="previousAction" attribute, then this method will always return null by default. To enable it in this situation, add the following method to the page flow:

protected boolean alwaysTrackPreviousAction()
{
    return true;
}

Returns:
a String that is the most recent URI.
See Also:
getPreviousPageInfo(), getCurrentPageInfo(), getPreviousActionInfo(), getPreviousForm(), getPreviousForwardPath(), getCurrentForwardPath()

getCurrentForwardPath

protected String getCurrentForwardPath()
Get the webapp-relative URI for the most recent page (in this page flow) shown to the user.

Note: if the current page flow does not use a @jpf:forward with a return-to="previousPage" or return-to="currentPage" attribute, then this method will always return null by default. To enable it in this situation, add the following method to the page flow:

protected boolean alwaysTrackPreviousPage()
{
    return true;
}

Returns:
a String that is the URI path for the most recent page shown to the user.
See Also:
getPreviousPageInfo(), getCurrentPageInfo(), getPreviousActionInfo(), getPreviousActionURI(), getPreviousForm(), getPreviousForwardPath()

getPreviousForwardPath

protected String getPreviousForwardPath()
Get the webapp-relative URI for the previous page (in this page flow) shown to the user. The previous page is the one shown before the most recent page.

Note: if the current page flow does not use a @jpf:forward with a return-to="previousPage" or return-to="currentPage" attribute, then this method will always return null by default. To enable it in this situation, add the following method to the page flow:

protected boolean alwaysTrackPreviousPage()
{
    return true;
}

Returns:
a String that is the URI path for the previous page shown to the user.
See Also:
getPreviousPageInfo(), getCurrentPageInfo(), getPreviousActionInfo(), getPreviousActionURI(), getPreviousForm(), getCurrentForwardPath()

getCurrentPageInfo

public final PreviousPageInfo getCurrentPageInfo()
Get information about the most recent page (in this page flow) shown to the user.

Note: if the current page flow does not use a @jpf:forward with a return-to="previousPage" or return-to="currentPage" attribute, then this method will always return null by default. To enable it in this situation, add the following method to the page flow:

protected boolean alwaysTrackPreviousPage()
{
    return true;
}

Returns:
a PreviousPageInfo with information about the most recent page shown to the user.
See Also:
getPreviousPageInfo(), getPreviousActionInfo(), getPreviousActionURI(), getPreviousForm(), getPreviousForwardPath(), getCurrentForwardPath()

getPreviousPageInfo

public final PreviousPageInfo getPreviousPageInfo()
Get information about the previous page (in this page flow) shown to the user. The previous page is the one shown before the most recent page.

Note: if the current page flow does not use a @jpf:forward with a return-to="previousPage" or return-to="currentPage" attribute, then this method will always return null by default. To enable it in this situation, add the following method to the page flow:

protected boolean alwaysTrackPreviousPage()
{
    return true;
}

Returns:
a PreviousPageInfo with information about the previous page shown to the user.
See Also:
getCurrentPageInfo(), getPreviousActionInfo(), getPreviousActionURI(), getPreviousForm(), getPreviousForwardPath(), getCurrentForwardPath()

getPreviousActionInfo

public final PreviousActionInfo getPreviousActionInfo()
Get information about the most recent action run in this page flow.

Note: if the current page flow does not use a @jpf:forward with a return-to="previousAction" attribute, then this method will always return null by default. To enable it in this situation, add the following method to the page flow:

protected boolean alwaysTrackPreviousAction()
{
    return true;
}

Returns:
a PreviousActionInfo with information about the most recent action run in this page flow.
See Also:
getPreviousPageInfo(), getCurrentPageInfo(), getPreviousActionURI(), getPreviousForm(), getPreviousForwardPath(), getCurrentForwardPath()

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in class PageFlowManagedObject

valueUnbound

public void valueUnbound(HttpSessionBindingEvent event)
Callback when this page flow is removed from the user session. Causes FlowController.onDestroy() to be called.

Specified by:
valueUnbound in interface HttpSessionBindingListener
Overrides:
valueUnbound in class PageFlowManagedObject