Spring WebFlow

"Spring WebFlow (SWF) is a product focused on the definition and execution of page flow within a web application..."

TODO: This needs to be updated to SWF 1.0.


Integration with Spring Webflow is done through DanubeFlowController which is an implementation of Controller . It uses DanubeExternalContext as implementation of ExternalContext .


DanubeFlowController has several attributes:

  • flowLocator - a flow locator. Setting a flow locator is going to set flow executor (FlowExecutorImpl ) implicitly.
  • flowExecutor - a flow locator.
  • defaultFlowId - default flow id.
  • argumentExtractor - an argument extractor. Defaulted to the FlowExecutorArgumentExtractor .
  • sessionManager - session manager to be used. If not set then defaulted to SimpleSessionManager .
  • attributes - flow attributes. They are equivalent to static, servlet context attributes.

Note: DanubeFlowController implementation is based on FlowController so most of the attributes are the same (like flowLocator, flowExecutor, defaultFlowId, argumentExtractor).


Here is an example of an configuration of Spring Webflow (with FreeMarker ) taken from supplied demo:

     * This bean defines beans application context.
     * It references MVC controller defined at the "/guess.do" path.
    <bean name="webflow-freemarker-example-applicaiton" class="org.abstracthorizon.danube.http.HTTPContext">
        <property name="components">
                <bean class="org.abstracthorizon.danube.http.matcher.Prefix">
                    <property name="prefix"><value>/guess.do</value></property>
                    <property name="connectionHandler"><ref bean="guess.do"/></property>

     * This is MVC controller that has Spring WebFlow as a controller and FreeMarker as a view adapter.
    <bean name="guess.do" class="org.abstracthorizon.danube.http.HTTPMVCConnectionHandler">
        <property name="controller"><ref bean="webFlowController" /></property>
        <property name="view"><ref bean="freemarkerViewAdapter" /></property>

     * This is WebFlow controller. Flow locator is defined through flow registry bean and
     * "bean-explorer-flow" is set as defualt flow id
    <bean name="webFlowController" class="org.abstracthorizon.danube.webflow.DanubeFlowController">
        <property name="flowLocator"><ref bean="flowRegistry" /></property>
        <property name="defaultFlowId"><value>guess-flow</value></property>

     * Flow registry defines where flow definitions are to be read from.
    <bean id="flowRegistry" class="org.springframework.webflow.registry.XmlFlowRegistryFactoryBean">
      <property name="flowLocations" value="guess-flow.xml"/>

     * This is FreeMarker view adapter.
     * It defines directory "pages" as location of templates and ".page" as templates' suffix.
    <bean id="freemarkerViewAdapter" class="org.abstracthorizon.danube.freemarker.FreeMarkerViewAdapter" init-method="init">
        <property name="templatesLocation"><value>pages/</value></property>
        <property name="suffix"><value>.page</value></property>