Expert Spring MVC and Web Flow

(Dana P.) #1

an Actionor a FlowAttributeMapper. It is a convenient façade that allows you to access infor-
mation about the currently executing request and the environment in which it is executing.
See Listing 12-5.


Listing 12-15.org.springframework.webflow.RequestContext


public interface RequestContext {
ExternalContext getExternalContext();
FlowExecutionContext getFlowExecutionContext();
Scope getRequestScope();
Scope getFlowScope();
Map getProperties();
Event getLastEvent();
Transition getLastTransition();
void setProperties(Map properties);
Map getModel();
}


As you can see, you can access the ExternalContext, different levels of data scope, the
state of the conversation, and so on. The key point is that the RequestContextrepresents
context about the current request.
Table 12-5 summarizes the keyartifacts that provide information about the execution of
a flow.


Table 12-5.Main Artifacts Used for the Execution of a Flow


Artifact Description


org.springframework.webflow.ExternalContext Provides access to the external
environment in which Spring Web
Flow is executing.


org.springframework.webflow.ViewSelection Defines a logical view selected for
rendering.


org.springframework.webflow.execution.FlowExecution Represents the entire execution of a
top-level flow, including any
spawned subflows.


org.springframework.webflow.FlowSession Represents the execution of a single
flow definition (not including
subflows).


org.springframework.webflow.RequestContext Represents the execution of a single
request into Spring Web Flow trig-
gered by the occurrence of an
external event.


FlowExecutionListener


Spring Web Flow defines a rich event model that allows you to observe the life cycle of an
executing flow. You can write your own observer by implementing the org.springframework.
webflow.execution.FlowExecutionListenerinterface. See Listing 12-16.


CHAPTER 12 ■ADVANCED SPRING WEB FLOW 351
Free download pdf