无法让FlowHandlerMapping在Spring Webflow中运行

时间:2011-02-07 17:43:39

标签: spring-mvc spring-webflow

我在Spring 2.5.6中使用SWF 2.1。并试图让2.1的默认映射策略工作。我之前一直在使用1.0默认的映射策略(从请求参数中检索流ID)

在Spring MVC配置中,我使用simpleUrlMapping策略(order = 1)并声明了SimpleControllerHandlerAdapter bean。

<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>

SWF配置:

<bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
    <property name="flowExecutor" ref="flowExecutor"/>
</bean><!--     

Launches new flow executions and resumes existing executions. -->
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
    <webflow:flow-execution-repository max-executions="5" max-execution-snapshots="80"/>
</webflow:flow-executor>


<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
    <property name="flowExecutor" ref="flowExecutor" />
</bean>

<!-- 

Creates the registry of flow definitions for this application -->
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/flows"> 
    <webflow:flow-location-pattern value="/**/*-flow.xml"/>
</webflow:flow-registry>

<webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" development="true"/>

<bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
    <property name="viewResolvers">
        <list>
            <ref local="beanNameViewResolver"/>
            <ref local="internalResourceViewResolver"/>
        </list>
    </property>
</bean>
<!-- 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"  p:order="0">
    <property name="flowRegistry" ref="flowRegistry"/>
</bean>

以下是网络文件夹中的目录结构:

/WEB-INF/flows/flow1-name/flow1-flow.xml
/WEB-INF/flows/flow2-name/flow2-flow.xml
/WEB-INF/flows/flow3-name/flow3-flow.xml

我一直试图通过转到

来访问流程
http://www.appdomain.com/flow1-name

映射不起作用,我得到了404。

另外,我应该如何命名子流,我应该把它们放在哪里?我希望能够从多个顶级流程访问子流程。

1 个答案:

答案 0 :(得分:1)

我不知道web.xml中的servlet映射是什么样的,但http://www.appdomain.com/flow1-name似乎不包含webapp的名称,也可能包含servlet映射的名称。检查是否已达到DispatcherServlet。您可以通过启用org.springframework.web和org.springframework.webflow日志记录类别并查找输出来实现此目的。