Expert Spring MVC and Web Flow

(Dana P.) #1

FlowExecutionRepository Implementations


As discussed, Spring Web Flow represents an execution of a flow in the FlowExecutionobject,
and a FlowExecutionis loaded and saved from a repository while a logical conversation
remains active between requests. In a continuation-based repository, each conversation
“snapshot” is captured by an org.springframework.webflow.execution.repository.
continuation.FlowExecutionContinuationwhich represents a FlowExecutionat a single point
in time.
An org.springframework.webflow.execution.repository.continuation.
FlowExecutionContinuationis identified by a unique org.springframework.webflow.
execution.repository.FlowExecutionContinuationKey, which consists of two logical parts,
defined in Table 12-6.

Table 12-6.The Parts of a FlowExecutionContinuationKey
Name Description
ConversationId A unique idthat identifies a logical conversation or dialog between a user and
the server. This idremains the same for the duration of the logical conversation.
ContinuationId A “pointer” to a single instance of a FlowExecutionContinuationassociated
with a logical conversation.

Recall that in Chapter 11 the unique key submitted by the view back to the server to
participate in an ongoing conversation was called the _flowExecutionIdby default. This is a
String-encoded representation of the previously mentioned FlowExecutionContinuationKey
and consists of two delimited parts. The first part identifies the active, logical conversation
(in a repository), and the second part identifies the continuation (or restorable snapshot)
to restore. The_flowExecutionIdthat is submitted by a view is parsed into a
FlowExecutionContinuationKeyobject, which is then used to load the correct FlowExecution
from the repository.
Spring Web Flow provides a number of stateful implementations of
FlowExecutionRepositoryand a single, stateless, client-side implementation, as described in
the following sections.

Stateful FlowExecution Repositories


Stateful repositories manage their own state and are typically stored in server-side data struc-
tures such as the HTTP session. Two implementations exist: org.springframework.webflow.
execution.repository.continuation.ContinuationFlowExecutionRepositoryand
org.springframework.webflow.execution.repository.SimpleFlowExecutionRepository.

ContinuationFlowExecutionRepository
This implementation provides a stateful server-side solution that supports browser naviga-
tional button use.

356 CHAPTER 12 ■ADVANCED SPRING WEB FLOW

Free download pdf