且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在tomcat web.xml中重写URL

更新时间:2022-03-10 23:42:13

如果您是单独使用Tomcat,而不是通过modrewrite与Apache一起使用,则***的方法是安装重写过滤器并从web.xml中引用它.我过去使用的一种过滤器是来自tuckey.org(http://www.tuckey.org/)的UrlRewriteFilter.

If you are using Tomcat alone instead of with Apache with modrewrite, the best approach is to install a rewrite filter and reference it from your web.xml. One filter I have used in the past is UrlRewriteFilter from tuckey.org (http://www.tuckey.org/).

它在Google代码上,位于 http://code.google.com/p/urlrewritefilter/source/browse/trunk/src/test-web/WEB-INF/urlrewrite.xml .

It is on Google Code at http://code.google.com/p/urlrewritefilter/source/browse/trunk/src/test-web/WEB-INF/urlrewrite.xml.

上次更新是在2010年10月,但我确实记得它运行良好.配置文件是XMLish,而不是您在modrewrite中使用的很好的衬板.

Last update was in October 2010, but I do remember it working just fine. Config files are XMLish, not the nice one liners that you use in modrewrite.