org.springframework.webflow.mvc
Class FlowController

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.support.WebContentGenerator
              extended by org.springframework.web.servlet.mvc.AbstractController
                  extended by org.springframework.webflow.mvc.FlowController
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.web.servlet.mvc.Controller

public class FlowController
extends org.springframework.web.servlet.mvc.AbstractController
implements org.springframework.beans.factory.InitializingBean

Web controller for the Spring web MVC framework that routes incoming requests to one or more managed web flows. Requests into the web flow system are managed using a configurable ServletFlowExecutionManager. Consult the JavaDoc of that class for more information on how requests are processed.

Note that a single FlowController may manage executions for all flows of your application -- simply parameterize this controller from view code with the _flowId to execute. See the flowLauncher sample application for an example of this.

Configuration note: you may achieve fine-grained control over flow execution management by passing in a configured flow execution manager instance. Alternatively, if this controller should manage executions in the default manner for a single flow definition, simply configure the flow property.

Exposed configuration properties:

name default description
flowExecutionManager default Configures the HTTP servlet flow execution manager implementation to use.
flow null Configures a single Flow definition to manage. Note this property should only be set as a convenience if fine-grained configuration of the flowExecutionManager is not neccessary.

Author:
Erwin Vervaet, Keith Donald
See Also:
Flow, ServletFlowExecutionManager

Field Summary
 
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator
HEADER_CACHE_CONTROL, HEADER_EXPIRES, HEADER_PRAGMA, METHOD_GET, METHOD_HEAD, METHOD_POST
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
FlowController()
          Create a new FlowController.
 
Method Summary
 void afterPropertiesSet()
           
protected  ServletFlowExecutionManager getFlowExecutionManager()
          Returns the flow execution manager used by this controller.
protected  org.springframework.web.servlet.ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void initDefaults()
          Set default properties for this controller.
 void setFlow(Flow flow)
          Convenience setter that configures a single flow definition for this controller to manage.
 void setFlowExecutionManager(ServletFlowExecutionManager manager)
          Configures the flow execution manager implementation to use.
protected  org.springframework.web.servlet.ModelAndView toModelAndView(ViewDescriptor viewDescriptor)
          Create a ModelAndView object based on the information in given view descriptor.
 
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
 
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseExpiresHeader
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, isContextRequired
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowController

public FlowController()
Create a new FlowController.

The "cacheSeconds" property is by default set to 0 (so no caching for web flow controllers).

Method Detail

initDefaults

protected void initDefaults()
Set default properties for this controller.


getFlowExecutionManager

protected ServletFlowExecutionManager getFlowExecutionManager()
Returns the flow execution manager used by this controller.

Returns:
the HTTP flow execution manager

setFlowExecutionManager

public void setFlowExecutionManager(ServletFlowExecutionManager manager)
Configures the flow execution manager implementation to use. Note: do not call both this method and setFlow() -- call one or the other.

Parameters:
manager - the flow execution manager
See Also:
setFlow(Flow)

setFlow

public void setFlow(Flow flow)
Convenience setter that configures a single flow definition for this controller to manage. This is a convenience feature to make it easy to configure the flow for a controller which just uses the default flow execution manager. Note: do not call both this method and setFlowExecutionManager() -- call one or the other.

Parameters:
flow - the flow that this controller will manage
See Also:
setFlowExecutionManager(ServletFlowExecutionManager)

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

handleRequestInternal

protected org.springframework.web.servlet.ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response)
                                                                      throws java.lang.Exception
Specified by:
handleRequestInternal in class org.springframework.web.servlet.mvc.AbstractController
Throws:
java.lang.Exception

toModelAndView

protected org.springframework.web.servlet.ModelAndView toModelAndView(ViewDescriptor viewDescriptor)
Create a ModelAndView object based on the information in given view descriptor. Subclasses can override this to return a specialized ModelAndView or to do custom processing on it.

Parameters:
viewDescriptor - the view descriptor to convert
Returns:
a new ModelAndView object


Copyright © 2005. All Rights Reserved.