Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

confusion about spring webflow execution key, what's the semantics behind

Recently, I looked at spring 2.3 webflow booking-faces demo, I found it strange that a different flow execution key is assigned every time I click to "browse" hotel detail.

When I search the hotels and page to the 5th page of the search result, I get an URL with execution=e1s2. Then I click to browse a hotel detail, I get an URL with execution=e1s3. But when I click the "back to search" button, I found the page is directed to the first page of the search list with an execution=e1s4 URL, and the paging state is missed. However, browsing step is defined in the same flow definition with hotel search act and paging var is defined within flow scope.

My question is whether a new execution key parameter means a new flow execution? What's the semantics? If so, How can I configure to stick into an identical flow execution when I click "back to search" button.

Thanks

like image 478
spaadecon Avatar asked Dec 26 '11 02:12

spaadecon


People also ask

How does Spring Webflow work?

Spring Web Flow provides a declarative flow definition language for authoring flows on a higher level of abstraction. It allows it to be integrated into a wide range of applications without any changes (to the flow programming model) including Spring MVC, JSF, and even Portlet web applications.

What is flow execution key?

Class FlowExecutionKeyA key that uniquely identifies a flow execution in a managed FlowExecutionRepository . Serves as a flow execution's persistent identity. This class is abstract. The repository subsystem encapsulates the structure of concrete key implementations.

What are the modules of spring Webflow?

Spring's web module provides a wealth of unique web support features, including: Clear separation of roles - controller, validator, command object, form object, model object, DispatcherServlet, handler mapping, view resolver, etc. Each role can be fulfilled by a specialized object.

Which Spring Web Flow component maps the request to a particular Web Flow?

Configuring Web Flow in Spring. Spring Web Flow is built on a foundation of Spring MVC. That means all requests to a flow first go through Spring MVC's DispatcherServlet .


1 Answers

To be precise: the flow execution key (eg. "e1s2") indeed consists of two parts:

  • "e1": This part identifies the flow execution. Each time you start a new flow, a new flow execution is created. A flow execution essentially holds all state associated with the executing flow (i.e. the conversation you're having with the web application). When a flow hits an end-state, the flow execution (and all associated snapshots) will be destroyed.
  • "s2": This part identifies a snapshot within the flow execution. Webflow uses so-called continuation snapshots to be able to support the browser back and refresh buttons. On every request into a flow execution, webflow creates a new snapshot that allows you to continue from that point onward if needed, for instance when you use the browser back button.

See also: https://docs.spring.io/spring-webflow/docs/current/api/org/springframework/webflow/execution/repository/support/CompositeFlowExecutionKey.html

Keep in mind that the flow execution key is not intended to be human readable or be interpreted by other software. This is essentially an internal webflow artifact.

like image 138
klr8 Avatar answered Oct 05 '22 21:10

klr8