Class FlowDefinitionResourceFactory
java.lang.Object
org.springframework.webflow.config.FlowDefinitionResourceFactory
A factory for creating flow definition resources that serve as pointers to external Flow definition files.
- Author:
- Keith Donald, Scott Andrews
-
Constructor Summary
ConstructorDescriptionCreates a new flow definition resource factory using a default resource loader.FlowDefinitionResourceFactory
(org.springframework.core.io.ResourceLoader resourceLoader) Creates a new flow definition resource factory using the specified resource loader. -
Method Summary
Modifier and TypeMethodDescriptioncreateClassPathResource
(String path, Class<?> clazz) Create a classpath-based resource from the path provided.createFileResource
(String path) Create a file-based based resource from the file path provided.createResource
(String path) Create a flow definition resource from the path location provided.createResource
(String path, AttributeMap<Object> attributes) Create a flow definition resource from the path location provided.createResource
(String path, AttributeMap<Object> attributes, String flowId) Create a flow definition resource from the path location provided.createResources
(String pattern, AttributeMap<Object> attributes) Create an array of flow definition resources from the path pattern location provided.protected String
getFlowId
(org.springframework.core.io.Resource flowResource) Obtains the flow id from the flow resource.void
setBasePath
(String basePath) Sets the base removed from the flow path when determining the default flow id.
-
Constructor Details
-
FlowDefinitionResourceFactory
public FlowDefinitionResourceFactory()Creates a new flow definition resource factory using a default resource loader. -
FlowDefinitionResourceFactory
public FlowDefinitionResourceFactory(org.springframework.core.io.ResourceLoader resourceLoader) Creates a new flow definition resource factory using the specified resource loader.- Parameters:
resourceLoader
- the resource loader
-
-
Method Details
-
setBasePath
Sets the base removed from the flow path when determining the default flow id.'/WEB-INF' by default
- Parameters:
basePath
- the flow's base path
-
createResource
Create a flow definition resource from the path location provided.- Parameters:
path
- the encodedResource
path.- Returns:
- the flow definition resource
-
createResource
Create a flow definition resource from the path location provided. The returned resource will be configured with the provided attributes.- Parameters:
path
- the encodedResource
path.attributes
- the flow definition meta attributes to configure- Returns:
- the flow definition resource
-
createResource
public FlowDefinitionResource createResource(String path, AttributeMap<Object> attributes, String flowId) Create a flow definition resource from the path location provided. The returned resource will be configured with the provided attributes and flow id.- Parameters:
path
- the encodedResource
path.attributes
- the flow definition meta attributes to configureflowId
- the flow definition id to configure- Returns:
- the flow definition resource
-
createResources
public FlowDefinitionResource[] createResources(String pattern, AttributeMap<Object> attributes) throws IOException Create an array of flow definition resources from the path pattern location provided.- Parameters:
pattern
- the encodedResource
path pattern.attributes
- meta attributes to apply to each flow definition resource- Returns:
- the flow definition resources
- Throws:
IOException
-
createFileResource
Create a file-based based resource from the file path provided.- Parameters:
path
- theFileSystemResource
path- Returns:
- the file-based flow definition resource
-
createClassPathResource
Create a classpath-based resource from the path provided.- Parameters:
path
- theClassPathResource
pathclazz
- to specify if the path should be relative to another class- Returns:
- the classpath-based flow definition resource
-
getFlowId
Obtains the flow id from the flow resource. By default, the flow id becomes the portion of the path between the basePath and the filename. If no directory structure is available then the filename without the extension is used. Subclasses may override.For example, '${basePath}/booking.xml' becomes 'booking' and '${basePath}/hotels/booking/booking.xml' becomes 'hotels/booking'
- Parameters:
flowResource
- the flow resource- Returns:
- the flow id
-