From a90a44314c0e7e38044a51a12290c1e8fe3f398c Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Mon, 22 Sep 2008 15:00:38 +0000 Subject: [PATCH] flow handler --- spring-webflow-reference/src/spring-mvc.xml | 91 ++++++--------------- 1 file changed, 23 insertions(+), 68 deletions(-) diff --git a/spring-webflow-reference/src/spring-mvc.xml b/spring-webflow-reference/src/spring-mvc.xml index 56801724..2089d0ca 100644 --- a/spring-webflow-reference/src/spring-mvc.xml +++ b/spring-webflow-reference/src/spring-mvc.xml @@ -36,14 +36,29 @@ ]]> - Mapping URLs to Flows + Dispatching to flows - The DispatcherServlet maps request URLs to handlers. + The DispatcherServlet maps requests for application resources to handlers. A flow is one type of handler. - The simplest way to configure the Dispatcher to map to flows is to define a FlowIdHandlerMapping + + + The first step to dispatching requests to flows is to enable flow handling within Spring MVC. + To this, install the FlowHandlerAdapter: + + + + +]]> + + + 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 define a FlowIdHandlerMapping + + + ]]> @@ -56,9 +71,9 @@ - Flow Handlers + Implementing custom FlowHandlers - A FlowHandler manages executions of a single flow definition. + A FlowHandler manages the execution of a single flow definition in a servlet environment. A FlowHandler is responsible for: @@ -152,36 +167,13 @@ public class BookingFlowHandler extends AbstractFlowHandler { To use your FlowHandler, first deploy an instance to Spring so it can be mapped to a URL: ]]> +]]> - Then add the URL mapping rule: - - - - /hotels/booking=bookingFlowHandler - -]]> - - - With this configuration, accessing the URL /hotels/booking will launch the booking flow. + With this configuration, accessing the URL /hotels/booking will launch the hotels/booking flow. When the booking flow ends, the FlowHandler will process the flow execution outcome and redirect to the appropriate controller. - - Registering the FlowHandlerAdapter - - To enable flow handlers, make sure you define the special FlowHandlerAdapter. You only need to do this once. - - - - - -]]> - - FlowHandler Redirects @@ -209,43 +201,6 @@ public class BookingFlowHandler extends AbstractFlowHandler { - - Flow Controller - - With the FlowHandler MVC integration approach, you define one handler per flow. - This is overkill in the cases where default flow handling rules are sufficient. - - - For simple cases, consider using the FlowController to map flow requests to a single handler. - You only have to configure this controller once and it will apply the flow handling defaults outlined in the previous section. - Also, you can still override these defaults by configuring the controller's flowHandlers property. - - - Below is a typical FlowController definition: - - - -]]> - - - Below illustrates several URLs mapped to this controller: - - - - - /login=flowController - /hotels/booking=flowController - - -]]> - - - With this configuration, accessing /login launches the login flow. - Accessing /hotels/booking launches the booking flow. - - View Resolution