org.springframework.webflow.executor.jsf
Class FlowNavigationHandler

java.lang.Object
  extended by javax.faces.application.NavigationHandler
      extended by org.springframework.web.jsf.DecoratingNavigationHandler
          extended by org.springframework.webflow.executor.jsf.FlowNavigationHandler

public class FlowNavigationHandler
extends org.springframework.web.jsf.DecoratingNavigationHandler

An implementation of a JSF NavigationHandler that provides integration with Spring Web Flow. Responsible for delegating to Spring Web Flow to launch and resume flow executions, treating JSF action outcomes (like a command button click) as web flow events. This class delegates to the standard NavigationHandler implementation when a navigation request does not pertain to a flow execution.

The following navigation handler algorithm is implemented by default:

If a flow execution has been restored in the current request:

If a flow execution has not been restored in the current request:

How the flowId and eventId arguments are extracted can be customized by setting a custom argument extractor. Note about customization: since NavigationHandlers managed directly by the JSF provider cannot be benefit from DependencyInjection, See Spring's DelegatingNavigationHandlerProxy when you need to customize a FlowNavigationHandler instance.

Author:
Craig McClanahan, Colin Sampaleanu, Keith Donald

Field Summary
protected  org.apache.commons.logging.Log logger
          Logger, usable by subclasses.
 
Constructor Summary
FlowNavigationHandler()
          Create a new FlowNavigationHandler using the default constructor.
FlowNavigationHandler(javax.faces.application.NavigationHandler originalNavigationHandler)
          Create a new FlowNavigationHandler, wrapping the specified standard navigation handler implementation.
 
Method Summary
protected  MutableAttributeMap createInput(ExternalContext context)
          Factory method that creates the input attribute map for a newly created FlowExecution.
 FlowExecutorArgumentExtractor getArgumentExtractor()
          Returns the argument extractor used by this navigation handler.
 org.springframework.binding.mapping.AttributeMapper getInputMapper()
          Returns the configured flow execution input mapper.
 void handleNavigation(javax.faces.context.FacesContext facesContext, java.lang.String fromAction, java.lang.String outcome, javax.faces.application.NavigationHandler originalNavigationHandler)
           
 void setArgumentExtractor(FlowExecutorArgumentExtractor argumentExtractor)
          Sets the argument extractor to use by this navigation handler.
 void setInputMapper(org.springframework.binding.mapping.AttributeMapper inputMapper)
          Sets the service responsible for mapping attributes of an ExternalContext to a new FlowExecution during a launch flow operation.
 
Methods inherited from class org.springframework.web.jsf.DecoratingNavigationHandler
callNextHandlerInChain, getDecoratedNavigationHandler, handleNavigation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Logger, usable by subclasses.

Constructor Detail

FlowNavigationHandler

public FlowNavigationHandler()
Create a new FlowNavigationHandler using the default constructor.


FlowNavigationHandler

public FlowNavigationHandler(javax.faces.application.NavigationHandler originalNavigationHandler)
Create a new FlowNavigationHandler, wrapping the specified standard navigation handler implementation.

Parameters:
originalNavigationHandler - Standard NavigationHandler we are wrapping
Method Detail

getArgumentExtractor

public FlowExecutorArgumentExtractor getArgumentExtractor()
Returns the argument extractor used by this navigation handler.


setArgumentExtractor

public void setArgumentExtractor(FlowExecutorArgumentExtractor argumentExtractor)
Sets the argument extractor to use by this navigation handler. Call to customize how flow id and event id arguments are extracted.


getInputMapper

public org.springframework.binding.mapping.AttributeMapper getInputMapper()
Returns the configured flow execution input mapper.


setInputMapper

public void setInputMapper(org.springframework.binding.mapping.AttributeMapper inputMapper)
Sets the service responsible for mapping attributes of an ExternalContext to a new FlowExecution during a launch flow operation.

The default implementation simply exposes all request parameters as flow execution input attributes. May be null.

See Also:
RequestParameterInputMapper

handleNavigation

public void handleNavigation(javax.faces.context.FacesContext facesContext,
                             java.lang.String fromAction,
                             java.lang.String outcome,
                             javax.faces.application.NavigationHandler originalNavigationHandler)
Specified by:
handleNavigation in class org.springframework.web.jsf.DecoratingNavigationHandler

createInput

protected MutableAttributeMap createInput(ExternalContext context)
Factory method that creates the input attribute map for a newly created FlowExecution. This implementation uses the registered input mapper, if any.

Parameters:
context - the external context
Returns:
the input map, or null if no input


Copyright © 2004-2007. All Rights Reserved.