public class FlowDefinitionResourceFactory extends Object
This implementation overrides the behavior of the built-in factory with regard to handling absolute paths while still supporting relative paths.
| Modifier and Type | Field and Description |
|---|---|
private static String |
CLASSPATH_SCHEME
Classpath scheme prefix.
|
private static String |
CLASSPATH_STAR_SCHEME
Wildcard classpath scheme prefix.
|
private static String |
FILESYSTEM_SCHEME
File scheme prefix.
|
private org.springframework.core.io.ResourceLoader |
resourceLoader
Spring resource loader.
|
private static String |
SLASH
Path separator.
|
| Constructor and Description |
|---|
FlowDefinitionResourceFactory(org.springframework.core.io.ResourceLoader loader)
Creates a new flow definition resource factory using the specified resource loader.
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.webflow.config.FlowDefinitionResource |
createResource(String basePath,
String path,
org.springframework.webflow.core.collection.AttributeMap<Object> attributes,
String flowId)
Create a flow definition resource from the path location provided.
|
Collection<org.springframework.webflow.config.FlowDefinitionResource> |
createResources(String basePath,
String pattern,
org.springframework.webflow.core.collection.AttributeMap<Object> attributes)
Create an array of flow definition resources from the path pattern location provided.
|
protected String |
getFlowId(String basePath,
org.springframework.core.io.Resource flowResource)
Obtains the flow id from the flow resource.
|
private boolean |
isAbsolute(String path)
Check if a path starts with a known scheme.
|
private String |
removeScheme(String path)
Remove the scheme from a path.
|
private String |
truncateFilePath(String filePath,
String basePath)
If the file path contains the base path, then the part after the base path is returned,
otherwise the entire file path is returned.
|
@Nonnull @NotEmpty private static final String CLASSPATH_SCHEME
@Nonnull @NotEmpty private static final String CLASSPATH_STAR_SCHEME
@Nonnull @NotEmpty private static final String FILESYSTEM_SCHEME
@Nonnull @NotEmpty private static final String SLASH
@Nonnull private final org.springframework.core.io.ResourceLoader resourceLoader
public FlowDefinitionResourceFactory(@Nonnull org.springframework.core.io.ResourceLoader loader)
loader - the resource loaderpublic org.springframework.webflow.config.FlowDefinitionResource createResource(@Nullable String basePath, @Nonnull@NotEmpty String path, @Nonnull org.springframework.webflow.core.collection.AttributeMap<Object> attributes, @Nonnull@NotEmpty String flowId)
basePath - base location to use for a relative pathpath - the encoded Resource path.attributes - the flow definition meta attributes to configureflowId - the flow definition id to configure@Nonnull public Collection<org.springframework.webflow.config.FlowDefinitionResource> createResources(@Nonnull@NotEmpty String basePath, @Nonnull@NotEmpty String pattern, @Nonnull org.springframework.webflow.core.collection.AttributeMap<Object> attributes) throws IOException
Unlike in the explicit case, we must have a base location provided here to properly compute the flow IDs.
basePath - base location for a relative path and in truncating to obtain the flow IDspattern - the encoded Resource path patternattributes - the flow definition meta attributes to configureIOException - if resolving the resources failsprotected String getFlowId(@Nonnull@NotEmpty String basePath, @Nonnull org.springframework.core.io.Resource flowResource) throws IOException
This is the key override from the SWF version, because it only operates on pattern-based flows, and it assumes a base path to strip. Explicit flow mappings are all assumed to have a flow ID explicitly assigned.
basePath - the base path applied to the computationflowResource - the flow resourceIOException - if unable to obtain information about the underlying resource@Nonnull @NotEmpty private String truncateFilePath(@Nonnull@NotEmpty String filePath, @Nonnull@NotEmpty String basePath)
filePath - file path to examinebasePath - base path to stripprivate boolean isAbsolute(@Nonnull@NotEmpty String path)
path - path to checkCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.