Spring Web Flow和Url重写过滤器-清理URL
||
我正在研究Spring MVC + Web Flow Web应用程序。我已经将“ 0”映射到MVC Controller,将“ 1”映射到Flow Controller。要从网址中删除“ 2”,我正在尝试使用“ 3”。
MVC控制器(@Controller)中的映射可以很好地实现:
http://localhost:8080/spring/home
->渲染home
视图。
但是,当请求发送到WebFlow Controller时,出现错误,导致出现“ 6”:
http://localhost:8080/spring/test
->重定向到http://localhost:8080/spring/app/test?execution=e1s1
->page not found
。
如何从URL中删除/app
并使一切正常工作?
urlrewrite.xml:
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE urlrewrite PUBLIC \"-//tuckey.org//DTD UrlRewrite 3.0//EN\" \"urlrewrite3.0.dtd\">
<urlrewrite default-match-type=\"wildcard\">
<!-- to remove /app -->
<rule>
<from>/**</from>
<to>/app/$1</to>
</rule>
<outbound-rule>
<from>/app/**</from>
<to>/$1</to>
</outbound-rule>
</urlrewrite>
分派器servlet映射:
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
简单控制器:
@Controller
public class MainController {
@RequestMapping(value={\"/home\", \"/\"})
public String index(Model model) {
return \"index\";
}
}
一些日志:
DEBUG [FlowHandlerMapping:108] : Mapping request with URI \'/spring/app/test\' to flow with id \'test\'
DEBUG [FlowExecutorImpl:135] : Launching new execution of flow \'test\' with input null
DEBUG [FlowDefinitionRegistryImpl:59] : Getting FlowDefinition with id \'test\'
DEBUG [FlowExecutionImplFactory:78] : Creating new execution of \'test\'
...
DEBUG [FlowExecutionImpl:417] : Assigned key e2s1
DEBUG [FlowHandlerAdapter:367] : Sending flow execution redirect to \'/spring/app/test?execution=e2s1\'
DEBUG [DispatcherServlet:824] : Null ModelAndView returned to DispatcherServlet with name \'spring\': assuming HandlerAdapter completed request handling
DEBUG [DispatcherServlet:674] : Successfully completed request
DEBUG [DispatcherServlet:693] : DispatcherServlet with name \'spring\' processing GET request for [/spring/app/app/test]
DEBUG [FlowHandlerMapping:114] : No flow mapping found for request with URI \'/spring/app/app/test\'
WARN [PageNotFound:947] : No mapping found for HTTP request with URI [/spring/app/app/test] in DispatcherServlet with name \'spring\'
没有找到相关结果
已邀请:
2 个回复
鲁釜头
配置:
编辑 无法使用自定义流处理程序,如下所示:
凄挡