Expert Spring MVC and Web Flow

(Dana P.) #1
public ViewSelection signalEvent(
String eventId,
String flowExecutionId,
ExternalContext context
) throws FlowException;
}

■NoteYou will notice that the FlowExecutionManagerisn’t responsible for ending a flow. It is the
responsibility of the flow itself to determine when it has finished.

When a request is sent from a browser to launch a new flow execution or signal an event
in an existing execution, that request is expected to provide the appropriate parameters. The
initial request handler (or “Front Controller”), typically an adapter between a web framework
like Spring MVC and Spring Web Flow, is then expected to extract those parameters and invoke
this FlowExecutionManagerfaçade. To launch a new flow execution, the _flowIdparameter is
required. To signal an event in an existing flow execution, the _flowExecutionIdand _eventId
parameters are required.
The default names by which these logical FlowExecutionManagerrequest parameters are
defined are sensible (_flowId, _flowExecutionId, and _eventId). If you wish to change them,
however, you can configure the controller adapters such as the Spring MVC FlowController
with a custom org.springframework.webflow.manager.support.
FlowExecutionManagerParameterExtractor.

FlowExecutions


A single execution of a flow definition is a core concept within Spring Web Flow. This concept is
realized by the org.springframework.webflow.execution.FlowExecutioninterface. A single flow
definition may have any number of active FlowExecutions executing in parallel, where each
FlowExecutionrepresents a unique instance of that flow, for a given user at a point in time.

■Tip It may help to think of a Flow as being analgous to a class, a definitional construct, whereas a
FlowExecutionis an instance of that class, an active construct.

You might assume a FlowExecutionimplementation is simply a glorified Maprepresenting
a snapshot of conversational state, but it is actually a much richer object. A FlowExecution
encapsulates not only the state of an executing flow including the current state, the flow
scope, and the stack of flow sessions, but also the behavior necessary to respond to external
events. See Listing 12-13.

348 CHAPTER 12 ■ADVANCED SPRING WEB FLOW

Free download pdf