0

Recently I study about Spring Web Flow and I am curious how SWF creates the flow ID from the flow definition files.

Below are part of spring documentation about registering flow id based on file location:

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, unless a registry bath path is defined.

 <webflow:flow-location path="/WEB-INF/flows/booking/booking.xml" />

Use the base-path attribute to define a base location for all flows in the application. All flow locations are then relative to the base path. The base path can be a resource path such as '/WEB-INF' or a location on the classpath like 'classpath:org/springframework/webflow/samples'.

<webflow:flow-registry id="flowRegistry" base-path="/WEB-INF">
<webflow:flow-location path="/hotels/booking/booking.xml" />
</webflow:flow-registry>

With a base path defined, the algorithm that assigns flow identifiers changes slightly. Flows will now be assigned registry identifiers equal to the the path segment between their base path and file name. For example, if a flow definition is located at '/WEB-INF/hotels/booking/booking-flow.xml' and the base path is '/WEB-INF' the remaining path to this flow is 'hotels/booking' which becomes the flow id.

I read the FlowDefintionRegistry source code but I found that the FlowDefinitionRegistry only parse the incoming request URL into flow id to be mapped with flow Id from flow defintion files but I did not found the way FlowDefinitionRegistry parse the flow location into flow id to get mapped with flow id from incoming request URL.

So my question is, how to implement my own algorithm to specify flow id also based on flow location?

Chrisma Andhika
  • 321
  • 2
  • 9
  • 19

1 Answers1

0

try to use this flow-location:

<webflow:flow-location-pattern value="/hotels/**/*.xml"/>

You should have the flow id will be something like: booking/booking

scricci85
  • 43
  • 9