# webflow

## Purpose

The `webflow` plug-in sets up Grails' support for Spring Webflow

## Examples

An example web flow:

    class BookController {
       …
       def shoppingCartFlow = {
           showCart {
               on("checkout").to "enterPersonalDetails"
               on("continueShopping").to "displayCatalogue"
           }
           …
           displayCatalogue {
                redirect(controller:"catalogue", action:"show")
           }
           displayInvoice()
       }
    }

## Description

Refer to the section on Web Flow in the Grails user guide which details how Grails' web flow support works.

Configured Spring Beans:

- `conversationManager` - An instance of the `org.springframework.webflow.conversation.impl.SessionBindingConversationManager` that manages conversations in the session.
- `executionListenerLoader` - A Web Flow `org.springframework.webflow.execution.factory.StaticFlowExecutionListenerLoader` that uses the `hibernateConversationListener` bean with flow execution events to manage the Hibernate session.
- `flowBuilderServices` - An instance of the `org.springframework.webflow.engine.builder.support.FlowBuilderServices` class used to help the Flow engine locate services.
- `flowExecutor` - An instance of the api:org.codehaus.groovy.grails.webflow.execution.GrailsFlowExecutorImpl that knows how to execute Grails flows based on flow execution keys.
- `flowExecutionFactory` - An instance of the `org.springframework.webflow.engine.impl.FlowExecutionImplFactory` that constructs flow executions.
- `flowExecutionSnapshotFactory` - An instance of the `org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshotFactory` class that is used to create flow snapshots that can be stored for resumption later on.
- `flowExecutionRepository` - An instance of the `org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository` class that is used to store flows.
- `flowRegistry` - An instance of the `org.codehaus.groovy.grails.webflow.engine.builder.ControllerFlowRegistry` class that stores persisted flows.
- `flowScopeRegistrar` - An instance of the Spring Web Flow `org.springframework.webflow.config.scope.ScopeRegistrar` class which registers the flow scopes with the `ApplicationContext` so that services can be scoped using flow scopes such as `flow`, `conversation` and `flash`.
- `hibernateConversationListener` - An instance of the Web Flow `org.codehaus.groovy.grails.webflow.persistence.SessionAwareHibernateFlowExecutionListener` class that manages the Hibernate session for the scope of a flow, allowing atomic use of flows.
- `viewFactoryCreator` - An instance of the `org.springframework.webflow.mvc.builder.MvcViewFactoryCreator` class used to construct views