我们有一个要求,在我们网站的一个子部分中处理登录和注册的方式略有不同。我们需要为以下每个URI分别分配流量。Spring流web URI映射到包含斜线的流ID(“/”)
/登录
/注册
/分段/登录
/分段/注册
我们流注册表使用位置图案被配置为在一个Webflow文档:
<flow:flow-registry id="flowRegistry" base-path="/WEB-INF/flow" flow-builder-services="flowBuilderServices">
<flow:flow-location-pattern value="/**/*-flow.xml" />
</flow:flow-registry>
而流XML文件具有以下结构:
./root/src/main/webapp/WEB-INF/flow
|-- subsection
| |-- login
| | `-- subsection-login-flow.xml
| `-- signup
| `-- subsection-signup-flow.xml
|-- login
| `-- login-flow.xml
`-- signup
`-- signup-flow.xml
的调试启用日志记录,我可以在四个流,ID分别创建的日志“登录”,“注册”,“小节/登录”和“小节/注册”看到:
24-Apr 09:21:50,887 DEBUG RMI TCP Connection(2)-127.0.0.1 definition.registry.FlowDefinitionRegistryImpl - Registering flow definition 'ServletContext resource [/WEB-INF/flow/subsection/login/subsection-login-flow.xml]' under id 'subsection/login'
24-Apr 09:21:50,887 DEBUG RMI TCP Connection(2)-127.0.0.1 definition.registry.FlowDefinitionRegistryImpl - Registering flow definition 'ServletContext resource [/WEB-INF/flow/subsection/signup/subsection-signup-flow.xml]' under id 'subsection/signup'
24-Apr 09:21:50,888 DEBUG RMI TCP Connection(2)-127.0.0.1 definition.registry.FlowDefinitionRegistryImpl - Registering flow definition 'ServletContext resource [/WEB-INF/flow/login/login-flow.xml]' under id 'login'
24-Apr 09:21:50,889 DEBUG RMI TCP Connection(2)-127.0.0.1 definition.registry.FlowDefinitionRegistryImpl - Registering flow definition 'ServletContext resource [/WEB-INF/flow/signup/signup-flow.xml]' under id 'signup'
当我去http://mysite.com/login或http://mysite.com/signup,一切都按预期工作。
然而,当我去http://mysite.com/subsection/login或http://mysite.com/subsection/signup,这些URI映射为“登录”(而不是“小节/登录”)或“注册”(而不是“小节/注册”):
24-Apr 09:32:16,917 DEBUG ajp-bio-8009-exec-5 mvc.servlet.FlowHandlerMapping - Mapping request with URI '/subsection/signup' to flow with id 'signup'
我在调试器中追踪了这一点,并且DefaultFlowUrlHandler.getFlowId方法仅基于最后一个“/”后面的任何内容返回流ID,因此对于URI“/ subsection/signup”,返回的流ID只是“注册”。
我在这里做错了什么?有什么办法强制所需的流量映射?
谢谢!