/** * Configure the base path where flow definitions are found. When specified, all * flow locations are relative to this path. Also when specified, by default flows * are assigned an id equal to the the path segment between their base path and * file name. * <p> * 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 then becomes the flow id. * <p> * If a flow definition is found directly on the base path, the file name minus * its extension is used as the flow id. * @param basePath the base path to use */ public FlowDefinitionRegistryBuilder setBasePath(String basePath) { if (basePath != null) { this.flowResourceFactory.setBasePath(basePath); } return this; }
public void afterPropertiesSet() { flowResourceFactory = new FlowDefinitionResourceFactory(flowBuilderServices.getApplicationContext()); if (basePath != null) { flowResourceFactory.setBasePath(basePath); } flowRegistry = new DefaultFlowRegistry(); flowRegistry.setParent(parent); registerFlowLocations(); registerFlowLocationPatterns(); registerFlowBuilders(); }
/** * Configure the base path where flow definitions are found. When specified, all * flow locations are relative to this path. Also when specified, by default flows * are assigned an id equal to the the path segment between their base path and * file name. * <p> * 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 then becomes the flow id. * <p> * If a flow definition is found directly on the base path, the file name minus * its extension is used as the flow id. * @param basePath the base path to use */ public FlowDefinitionRegistryBuilder setBasePath(String basePath) { if (basePath != null) { this.flowResourceFactory.setBasePath(basePath); } return this; }
public void testGetFlowCustomBasePathTrailingSlash() { Resource resource = resourceLoader.getResource("/WEB-INF/hotels/booking/booking-flow.xml"); factory.setBasePath("WEB-INF/"); assertEquals("hotels/booking", factory.getFlowId(resource)); }
public void testGetFlowIdFlowPathIsBasePath() { Resource resource = resourceLoader.getResource("/WEB-INF/hotels/booking/booking-flow.xml"); factory.setBasePath("/WEB-INF/hotels/booking"); assertEquals("booking-flow", factory.getFlowId(resource)); }
public void testGetFlowIdClassPathResource() { Resource resource = new ClassPathResource("org/springframework/webflow/sample/sample-flow.xml"); factory.setBasePath("classpath:org/springframework/webflow/"); assertEquals("sample", factory.getFlowId(resource)); }
public void testGetFlowIdCustomBasePathLeadingSlash() { Resource resource = resourceLoader.getResource("/WEB-INF/hotels/booking/booking-flow.xml"); factory.setBasePath("/WEB-INF"); assertEquals("hotels/booking", factory.getFlowId(resource)); }
public void testGetFlowIdCustomBasePathLeadingAndTrailingSlash() { Resource resource = resourceLoader.getResource("/WEB-INF/hotels/booking/booking-flow.xml"); factory.setBasePath("/WEB-INF/"); assertEquals("hotels/booking", factory.getFlowId(resource)); }
public void testGetFlowIdBasePathMismatch() { Resource resource = resourceLoader.getResource("/WEB-INF/hotels/booking/booking-flow.xml"); factory.setBasePath("/foo/bar"); assertEquals("WEB-INF/hotels/booking", factory.getFlowId(resource)); }
public void testGetFlowIdFileSystemResource() { Resource resource = new FileSystemResource( "/the/path/on/the/file/system/org/springframework/webflow/sample/sample-flow.xml"); factory.setBasePath("classpath:org/springframework/webflow/"); assertEquals("sample", factory.getFlowId(resource)); }
public void testGetFlowIdClassPathStarResource() { Resource resource = new ClassPathResource("org/springframework/webflow/sample/sample-flow.xml"); factory.setBasePath("classpath*:org/springframework/webflow/"); assertEquals("sample", factory.getFlowId(resource)); }
public void testGetFlowIdFileSystemResourceBasePathMatch() { Resource resource = new FileSystemResource("/the/path/on/the/file/system/sample-flow.xml"); factory.setBasePath("file:/the/path"); assertEquals("on/the/file/system", factory.getFlowId(resource)); }
public void testGetFlowIdCustomBasePath() { Resource resource = resourceLoader.getResource("/WEB-INF/hotels/booking/booking-flow.xml"); factory.setBasePath("WEB-INF"); assertEquals("hotels/booking", factory.getFlowId(resource)); }
public void testGetFlowIdFileSystemResourceNoBasePathMatch() { Resource resource = new FileSystemResource("/the/path/on/the/file/system/sample-flow.xml"); factory.setBasePath("classpath:org/springframework/webflow/"); assertEquals("the/path/on/the/file/system", factory.getFlowId(resource)); }
public void testGetFlowIdUrlResource() throws MalformedURLException { Resource resource = new UrlResource( "file:/the/path/on/the/file/system/org/springframework/webflow/sample/sample-flow.xml"); factory.setBasePath("classpath:org/springframework/webflow/"); assertEquals("sample", factory.getFlowId(resource)); }
public void afterPropertiesSet() { flowResourceFactory = new FlowDefinitionResourceFactory(flowBuilderServices.getApplicationContext()); if (basePath != null) { flowResourceFactory.setBasePath(basePath); } flowRegistry = new DefaultFlowRegistry(); flowRegistry.setParent(parent); registerFlowLocations(); registerFlowLocationPatterns(); registerFlowBuilders(); }
public void testGetFlowIdUrlResourceNoBasePathMatch() throws MalformedURLException { Resource resource = new UrlResource("file:/the/path/on/the/file/system/sample-flow.xml"); factory.setBasePath("classpath:org/springframework/webflow/"); assertEquals("the/path/on/the/file/system", factory.getFlowId(resource)); }
public void afterPropertiesSet() throws Exception { flowResourceFactory = new FlowDefinitionResourceFactory(flowBuilderServices.getApplicationContext()); if (basePath != null) { flowResourceFactory.setBasePath(basePath); } flowRegistry = new DefaultFlowRegistry(); flowRegistry.setParent(parent); registerFlowLocations(); registerFlowLocationPatterns(); registerFlowBuilders(); }