System Setup
Introduction
This chapter shows you how to setup the Web Flow system for use in any web environment.
webflow-config.xsd
Web Flow provides a Spring schema that allows you to configure the system.
To use this schema, include it in one of your infrastructure-layer beans files:
]]>
Basic system configuration
The next section shows the minimal configuration required to set up the Web Flow system in your application.
FlowRegistry
Register your flows in a FlowRegistry:
]]>
FlowExecutor
Deploy a FlowExecutor, the central service for executing flows:
]]>
See the Spring MVC and Spring Faces sections of this guide on how to integrate the Web Flow system with the MVC and JSF environment, respectively.
flow-registry options
Configuring custom FlowBuilder services
Use the flow-builder-services attribute to customize the services used to build the flows in a registry.
If no flow-builder-services tag is specified, the default service implementations are used.
When the tag is defined, you only need to reference the services you want to customize.
]]>
The configurable services are the conversion-service, formatter-registry, expression-parser, and view-factory-creator.
These services are configured by referencing custom beans you define. For example:
]]>
conversion-service
Use the conversion-service attribute to customize the ConversionService used by the Web Flow system.
Converters are used to convert from one type to another when required during flow execution.
The default ConversionService registers converters for your basic object types such as numbers, classes, and enums.
formatter-registry
Use the formatter-registry attribute to customize the FormatterRegistry used by the Web Flow system.
Formatters are used by Views to format model property values for display.
The default FormatterRegistry registers converters for your basic model object types such as numbers and dates.
expression-parser
Use the expression-parser attribute to customize the ExpressionParser used by the Web Flow system.
The default ExpressionParser uses the Unified EL if available on the classpath, otherwise OGNL is used.
view-factory-creator
Use the view-factory-creator attribute to customize the ViewFactoryCreator used by the Web Flow system.
The default ViewFactoryCreator produces Spring MVC ViewFactories capable of rendering JSP, Velocity, and Freemarker views.
Configuring FlowRegistry hierarchies
Use the parent attribute to link two flow registries together in a hierarchy.
When the child registry is queried, if it cannot find the requested flow it will delegate to its parent.
<-- Global flows shared by several applications -->
]]>
Specifying flow locations
Use the location element to specify paths to flow definitions to register.
By default, flows will be assigned registry identifiers equal to their filenames minus the file extension.
]]>
Assigning custom flow identifiers
Specify an id to assign a custom registry identifier to a flow:
]]>
Assigning flow meta-attributes
Use the flow-definition-attributes element to assign custom meta-attributes to a registered flow:
]]>
Registering flows using a location pattern
Use the flow-location-patterns element to register flows that match a specific resource location pattern:
]]>
flow-executor options
Attaching flow execution listeners
Use the flow-execution-listeners element to register listeners that observe the lifecycle of flow executions:
]]>
You may also configure a listener to observe only certain flows:
]]>
Tuning FlowExecution persistence
Use the flow-execution-repository element to tune flow execution persistence settings:
]]>
max-conversations
Tune the max-conversations attribute to place a cap on the number of conversations that can be created per user session.
max-snapshots
Tune the max-snapshots attribute to place a cap on the number of flow execution snapshots that can be taken per conversation.
conversation-manager
Set a custom ConversationManager to completely customize where conversational flow state is persisted.