org.apache.beehive.netui.pageflow
Class SharedFlowController

Object
  extended by PageFlowManagedObject
      extended by FlowController
          extended by SharedFlowController
All Implemented Interfaces:
Serializable, EventListener, HttpSessionBindingListener, ActionResolver, PageFlowConstants
Direct Known Subclasses:
GlobalApp

public abstract class SharedFlowController
extends FlowController
implements PageFlowConstants

Base "shared flow" class for controller logic, exception handlers, and state that can be shared by any number of page flows. A shared flow is not a page flow; it is used by page flows, but never becomes the "current page flow" (see PageFlowController for information on page flows and the "current page flow"). The class is configured through the @Jpf.Controller annotation.

A shared flow comes into existance in one of two ways:

When a shared flow is created, it is stored in the user session. It is only removed through a call to FlowController.remove() or through a call to PageFlowUtils.removeSharedFlow(java.lang.String, javax.servlet.http.HttpServletRequest).

Shared flow actions are defined with action methods or action annotations that determine the next URI to be displayed, after optionally performing arbitrary logic. A page or page flow can raise a shared flow action using the pattern "shared-flow-name.action-name". The shared flow name is the one chosen by the page flow in name on @Jpf.SharedFlowRef.

A referenced shared flow gets the chance to handle any uncaught page flow exception. It declares its exception handling through catches on @Jpf.Controller.

Properties in the current shared flow instance can be accessed from JSP 2.0-style expressions like this one: ${sharedFlow.sharedFlowName.someProperty}.

There may only be one shared flow in any package.

See Also:
PageFlowController, Serialized Form

Field Summary
 
Fields inherited from class FlowController
defaultLocale
 
Fields inherited from interface PageFlowConstants
ACTION_EXTENSION, ACTION_OVERRIDE, AUTO_VIEW_RENDER_FORWARD_NAME, BEGIN_ACTION_NAME, DEFAULT_FORWARD_OVERFLOW_COUNT, DEFAULT_NESTING_OVERFLOW_COUNT, DEFAULT_VIEW_RENDERING_EXTENSION, FORWARD_OVERFLOW_COUNT_PARAM, GLOBALAPP_CLASSNAME, GLOBALAPP_SOURCEFILE_NAME, JPF_EXTENSION, JPF_MODULE_CONFIG_EXTENSION, JPF_MODULE_CONFIG_GEN_DIR, JPF_MODULE_CONFIG_PREFIX, NESTING_OVERFLOW_COUNT_PARAM, PAGEFLOW_EXTENSION, PAGEFLOW_MODULE_CONFIG_EXTENSION, PAGEFLOW_MODULE_CONFIG_GEN_DIR, PAGEFLOW_MODULE_CONFIG_PREFIX, SECURE_FORWARDS_PARAM, VIEW_RENDERER_ATTRIBUTE_NAME, VIEW_RENDERER_URI_COMMAND, VIEW_RENDERING_EXTENSION_PARAM
 
Constructor Summary
SharedFlowController()
           
 
Method Summary
 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.
 String getDisplayName()
          Get the display name.
 String getModulePath()
          Get the Struts module path for actions in this shared flow.
 PreviousPageInfo getPreviousPageInfoLegacy(PageFlowController curJpf, HttpServletRequest request)
          Deprecated. This method will be removed without replacement in a future release.
 String getURI()
          Get the URI.
 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 savePreviousPageInfo(ActionForward forward, ActionForm form, ActionMapping mapping, HttpServletRequest request, ServletContext servletContext, boolean isSpecialForward)
          Store information about recent pages displayed.
 
Methods inherited from class FlowController
addActionError, addActionErrorExpression, addValidationError, addValidationError, afterAction, alwaysTrackPreviousAction, alwaysTrackPreviousPage, beforeAction, create, execute, generateToken, generateToken, getActionMapping, getActionMethod, getActions, getActionURI, getCurrentActionName, getDataSource, getDataSource, getDefaultLocale, getFormBean, getLocale, getLocale, getMapping, getMessageResources, getMessageResources, getModuleConfig, getModuleConfig, getRequest, getResources, getResources, getResources, getResponse, getRewrittenActionURI, getServlet, getSession, getUserPrincipal, handleException, internalExecute, invokeActionMethod, invokeExceptionHandler, isAction, isCancelled, isPageFlow, isTokenValid, isTokenValid, isTokenValid, isTokenValid, isUserInRole, login, logout, lookup, lookup, onCreate, onDestroy, onDestroy, onRefresh, refresh, reinitialize, remove, resetToken, resetToken, resolveAction, resolveAction, retrieveUserLocale, saveActionErrors, saveErrors, saveMessages, saveToken, sendError, sendError, setLocale, setLocale, theModuleConfig
 
Methods inherited from class PageFlowManagedObject
fieldIsUninitialized, getCreateTime, getServletContext, initializeField, valueBound, valueUnbound
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedFlowController

public SharedFlowController()
Method Detail

getModulePath

public String getModulePath()
Get the Struts module path for actions in this shared flow.

Specified by:
getModulePath in interface ActionResolver
Specified by:
getModulePath in class FlowController
Returns:
the Struts module path for actions in this shared flow.

persistInSession

public void persistInSession(HttpServletRequest request,
                             HttpServletResponse response)
Store this object in the user session, in the appropriate place. Used by the framework; normally should not be called directly.

Specified by:
persistInSession in class PageFlowManagedObject

ensureFailover

public 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. Note that this method is used by the framework and does not need to be called explicitly in most cases.

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

getURI

public String getURI()
Get the URI.

Specified by:
getURI in interface ActionResolver
Returns:
null, as this object is not URL-addressible.

getDisplayName

public String getDisplayName()
Get the display name. The display name for a shared flow is simply the class name.

Specified by:
getDisplayName in class PageFlowManagedObject
Returns:
the name of the shared flow class.

getPreviousPageInfoLegacy

public PreviousPageInfo getPreviousPageInfoLegacy(PageFlowController curJpf,
                                                  HttpServletRequest request)
Deprecated. This method will be removed without replacement in a future release.

Get a legacy PreviousPageInfo.

Specified by:
getPreviousPageInfoLegacy in class FlowController

savePreviousPageInfo

public void savePreviousPageInfo(ActionForward forward,
                                 ActionForm form,
                                 ActionMapping mapping,
                                 HttpServletRequest request,
                                 ServletContext servletContext,
                                 boolean isSpecialForward)
Store information about recent pages displayed. This is a framework-invoked method that should not normally be called directly.

Overrides:
savePreviousPageInfo in class FlowController

removeFromSession

public void removeFromSession(HttpServletRequest request)
Remove this instance from the session. When inside a shared flow action, FlowController.remove() may be called instead.

Specified by:
removeFromSession in class PageFlowManagedObject