是否有Tomcat / Java的URL重写引擎? [英] Is there a url rewriting engine for Tomcat/Java?

查看:114
本文介绍了是否有Tomcat / Java的URL重写引擎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何为Tomcat / Java提供URL重写支持?

mod_rewrite 为Apache提供此功能,甚至可以在URL到达处理程序之前修改URL(例如PHP)。 Java / Tomcat中是否有类似的工具?

mod_rewrite provides this functionality for Apache and can modify URLs even before they reach the handler (e.g. PHP). Is there a similar tool in Java/Tomcat ?

更具体地说,我们需要修改,例如

To be more specific we need modifications such as


  http://www.somedomain.com/person/1
      Maps to
  http://www.somedomain.com/details?personId=1

这应该对servlet代码透明,即我们应该能够访问 request.getParameter(personId)并获取personId(在这种情况下为1)。

And this should be transparent to the servlet code, i.e. we should be able to access request.getParameter("personId") in the servlet and get the personId (1 in this case).

您是否遇到过这种情况?你用了什么工具?

很想听听你的建议。

Did you come across such a scenario ? What tool did you use ?
Would love to hear your suggestions.

推荐答案

参见 URLRewriteFilter

这篇关于是否有Tomcat / Java的URL重写引擎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆