Announcement Announcement Module
No announcement yet.
Upgrading to 2.3 and still using WebFlow1FlowUrlHandler Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upgrading to 2.3 and still using WebFlow1FlowUrlHandler

    Hi all,
    I am attempting to upgrade to Webflow 2.3 but would like to still use WebFlow1FlowUrlHandler for the existing webflows until we can upgrade them too. But would also like all new flows to use the standard path location for the flow id. Hence both method needs to be working side by side.

    I have successfully configured the flow registry to map the old flows to their original flow ID and also the new ones mapped with the folder location as the id. See below:
    <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/jsp">
      <!-- Backward compatibilty to the old flows (relative to the jsp folder: -->
      <webflow:flow-location path="../weblflows/another-old-flow.xml" id="another-old-flow"/>
      <webflow:flow-location path="/oldstuff/some-old-flow.xml" id="some-old-flow"/>
      <!-- This will map all flows in the jsp folder, where the folder structure is the flow id. 
          So for example: /WEB-INF/jsp/abc/def/someStuff-flow.xml will have an id of abc/def
          This is then mapped to the URL /smvc/abc/def  With the /smvc being the servlet mapping to Spring (see web.xml) -->
      <webflow:flow-location-pattern value="/**/*-flow.xml" />
    I have then configured two FlowHandlerMapping beans, one using the detault url handler and one with the WebFlow1FlowUrlHandler. See here:
    <!-- Maps request paths to flows in the flowRegistry; e.g. a path of /hotels/booking looks for a flow with id "hotels/booking". -->
      <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
        <property name="order" value="1"/>
        <property name="flowRegistry" ref="flowRegistry" />
      <!-- For backward compatibility also need to map flows using the flowId parameter -->
      <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
        <property name="flowUrlHandler">
          <bean class="org.springframework.webflow.context.servlet.WebFlow1FlowUrlHandler"/> 
        <property name="order" value="2"/>
        <property name="flowRegistry" ref="flowRegistry" />
    And this works for the initial call to the flow. So both a request with a parameter _flowId set or one with a url that mapped to a flow id finds its way to the flow.

    But this is where things stop working. Now I think this is because the old way (using _flowId) does not always have the _flowId parameter within the URL and therefore the flow is never found. But it does always have an flow execution key, and hence I thought the flow could be found using this.

    What actually happens is the flows starts and immediatly does a redirect (becuase of the 'always-redirect-on-pause'). But this redirect does not include the _flowId paramerter and neither does it include the _flowExecutionKey parameter. Instead it uses the new 'execution' parameter to hold the execution id. This happens because it is using the DefaultFlowUrlHandler to build the redirect URL as opposed to the WebFlow1FlowUrlHandler. So I think I am missing some configuration here.

    Incidently, if the always-redirect-on-pause attribute is set to false within the flow executor, then this redirect does not occur and hence the first view state is successfully loaded. But then the next transistion with fail because the _flowId parameter is not sent, only the _flowExecutionKey. So same problem really.

    Firstly, is it possibly to have both the old WebFlow1FlowUrlHandler and the new DefaultFlowUrlHandler working side by side?

    If so, I am assuming I need further configuration of the FlowHandlerMapping. Or do I need a separate FlowHandlerAdapter as this is what sends the redirect?

    Hope this makes sense and any help would be appreciated!!

  • #2
    I might be mistaken, but I think you have to compartmentalize the 2 versions of web flow to different application spaces all together in order to have both working at the same time. I think the chances are slim they can share resources in the same space. They should be able to talk to the same resources of course.

    This is pure speculation on my part though. It may still be possible in some way I cannot imagine myself and I'm a Web Flow newbie really.
    In "The definitive guide to Web Flow" the authors write:
    Last edited by MiB; Jan 18th, 2012, 10:33 AM.


    • #3
      Thanks for your reply, but the flows themselves are webflow 2 compatible, just that they use the webflow1 mapping. We currently use webflow 2.0.8.
      Daft I know, but all the JSPs use a common URL (like webflow.mvc?_flowId=xxxx). A hang up from when we first started using webflow. So I am trying to save changing all the paths in all the JSPs. Something I think I might need to do.