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

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

问题描述

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

mod_rewrite 为 Apache 提供了此功能,并且可以在之前修改 URL他们到达处理程序(例如 PHP).Java/Tomcat 有没有类似的工具?

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

<前>http://www.somedomain.com/person/1映射到http://www.somedomain.com/details?personId=1

这对 servlet 代码应该是透明的,即我们应该能够访问 servlet 中的 request.getParameter("personId") 并获取 personId(在本例中为 1).

你遇到过这样的场景吗?你用的是什么工具?
很想听听您的建议.

解决方案

参见 URLRewriteFilter

How can we provide URL-Rewriting support for Tomcat/Java ?

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

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.

解决方案

See the URLRewriteFilter

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

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