开发者

Redirect in Tomcat 5.5 [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

Is there a simple way (just configuration) to tell Tomcat 5.5 to redirect all requests coming to "abc.com" to "www.abc.com" ?

I know that it's very easy if you do that in httpd, so I wonder whether Tomcat has such a functionality built in too?

Documentation: http://tomcat.apache.org/tomcat-5.5-doc/balancer-howto.html

But there is no documentation about the format of the rules.xml file and how web.xml should开发者_JS百科 look like. So any better pointers than the above documentation is already good help.


If you are referring to the balancer documentation, does it mean that you have Apache in front already? If so, just use mod_rewrite, otherwise read on.

Normally these things are implemented using ServletFilters, but that is part of your webapp and you said want configuration-only option.

Another alternative would be to write a Valve and add it to the configuration. Here's the list of standard Tomcat valves: http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html

Unfortunately, there is no valve (yet) which does what you need, but at least existing ones could be used for reference. It should be quite trivial, see its API (hint: look at invokemethod).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜