I am adding Spring Web Flow 2 to a very large existing web application that does not currently use Spring MVC or Web Flow. My task is to start the web stream by going to mySite.com/flows, and I'm having difficulties. My approach was to configure the DispatcherServlet with the /flows/* mapping and map the web stream to /flows . Here is my web.xml where DispatcherServlet is configured:
<servlet> <servlet-name>flow</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/flowContext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>flow</servlet-name> <url-pattern>/flows/*</url-pattern> </servlet-mapping>
I tried several ways for Web Flow to display on /flows . My first attempt was to use a thread registry with the base-path parameter:
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/app/flows"> <webflow:flow-location-pattern value="**/*-flow.xml" /> </webflow:flow-registry>
I understand that this will result in a folder structure inside /WEB-INF/app/flows to create a query mapping. My first test was to add my stream, booking-flow.xml inside a subfolder called booking ( /WEB-INF/app/flows/booking ). And great! - it worked as expected. I was able to access the stream from mySite.com/flows/booking. OK, but I don’t want /booking in the URL, so I moved booking-flow.xml from the booking folder and directly to WEB-INF/app/flows and expected this to work for me, but it’s not - I don’t think that the stream is displayed at all.
Does anyone know how I can map a stream to the root of a DispatcherServlet mapping, or is there a better way to approach this? I do not want DispatcherServlet to handle any requests outside /flows in my application. Is it just me, or is there very little documentation available in the Spring web stream?
Thanks!
source share