DispatcherServlet maps requests for application
resources to handlers. A flow is one type of handler.
The first step to dispatching requests to flows is to enable flow
handling within Spring MVC. To this, install the
<!-- Enables FlowHandler URL mapping --> <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"> <property name="flowExecutor" ref="flowExecutor" /> </bean>
Once flow handling is enabled, the next step is to map specific
application resources to your flows. The simplest way to do this is to
<!-- Maps request paths to flows in the flowRegistry; e.g. a path of /hotels/booking looks for a flow with id "hotels/booking" --> <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> <property name="flowRegistry" ref="flowRegistry"/> <property name="order" value="0"/> </bean>
Configuring this mapping allows the Dispatcher to map application
resource paths to flows in a flow registry. For example, accessing the
/hotels/booking would result in a registry
query for the flow with id
hotels/booking. If a flow is
found with that id, that flow will handle the request. If no flow is
found, the next handler mapping in the Dispatcher's ordered chain will
be queried or a "noHandlerFound" response will be returned.
When a valid flow mapping is found, the
FlowHandlerAdapter figures out whether to start a new
execution of that flow or resume an existing execution based on
information present the HTTP request. There are a number of defaults
related to starting and resuming flow executions the adapter
HTTP request parameters are made available in the input map of all starting flow executions.
When a flow execution ends without sending a final response, the default handler will attempt to start a new execution in the same request.
Unhandled exceptions are propagated to the Dispatcher unless the exception is a NoSuchFlowExecutionException. The default handler will attempt to recover from a NoSuchFlowExecutionException by starting over a new execution.
Consult the API documentation for
for more information. You may override these defaults by subclassing or
by implementing your own FlowHandler, discussed in the next