title: Spring Web Flow request mappings
body: <p>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 have the Web Flow triggered by going to mySite.com/flows, and I am having difficulties. My approach was to set up the DispatcherServlet with mapping of <code>/flows/*</code> and map Web Flow to <code>/flows</code>. Here is my web.xml where the DispatcherServlet is configured:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;flow&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/flowContext.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;flow&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/flows/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>I have tried several methods to get the Web Flow to map to <code>/flows</code>. My first try was to use a flow-registry with <code>base-path</code> setting:</p>
  
  <pre><code>&lt;webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/app/flows"&gt;
      &lt;webflow:flow-location-pattern value="**/*-flow.xml" /&gt;
  &lt;/webflow:flow-registry&gt;
  </code></pre>
  
  <p>My understanding is that this will take the folder structure inside of the <code>/WEB-INF/app/flows</code> to create the request mapping. My first test was to add my flow, <code>booking-flow.xml</code> inside a subfolder called <code>booking</code> (<code>/WEB-INF/app/flows/booking</code>). And, great! - it worked as expected. I was able to access the flow from mySite.com/flows/booking. OK, but I don't want <code>/booking</code> in the URL, so I moved the <code>booking-flow.xml</code> out of the <code>booking</code> folder, and straight into <code>WEB-INF/app/flows</code> and expected that to work for me, but it did not - I don't think the flow mapped at all.</p>
  
  <p>Does anyone know how I can map a flow to the root of the DispatcherServlet mapping, or is there a better way to approach this? I don't want the DispatcherServlet to handle any requests outside of <code>/flows</code> in my application. Is it just me, or is there very little documentation available on Spring Web Flow?</p>
  
  <p>Thanks!</p>