无法让 FlowHandlerMapping 在 Spring Webflow 中工作

发布于 2024-10-16 16:25:12 字数 2385 浏览 3 评论 0原文

我正在使用 SWF 2.1 和 Spring 2.5.6。我正在尝试让 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 文件夹中的目录结构:

/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。

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

I'm using SWF 2.1 with Spring 2.5.6. and am trying to get the default mapping strategy for 2.1 to work. I had previously been using the mapping strategy that was the 1.0 default (whereby the flow id was retrieved from the request parameters)

In spring MVC configuration, I'm using the simpleUrlMapping strategy (order = 1) and have declared the SimpleControllerHandlerAdapter bean.

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

SWF configuration:

<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>

Here is the directory structure in the web folder:

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

I have been trying to access the flows by going to

http://www.appdomain.com/flow1-name

the mapping does not work and I get a 404.

Also, how should I name subflows and where should I put them? I would like to be able to access the subflows from more than one top-level flow.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

送你一个梦 2024-10-23 16:25:12

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

I don't know what your servlet mapping in web.xml looks like but http://www.appdomain.com/flow1-name doesn't seem to include the name of your webapp and possibly the name of your servlet mapping. Check if the DispatcherServlet is getting reached at all. You can do that by enabling the org.springframework.web and org.springframework.webflow logging categories and looking for the output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文