且构网

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

如何隐藏在其与Tomcat的URL应用程序上下文?

更新时间:2023-10-12 08:18:22

这是有点复杂,但你可以使用URL重写如的 tuckey
重写出站网址,删除/我的上下文preFIX(由出站网址我的意思是你的web应用(S)内生成的URL)。查看该元素的文档在 HTTP ://urlrewritefilter.google$c$c.com/svn/trunk/src/doc/manual/3.2/index.html

This is getting a bit complicated, but you can use a URL rewriter such as tuckey to rewrite outbound URLs, removing the /my-context prefix (by "outbound URLs" I mean URLs being generated inside your webapp(s)). Check out the documentation for the element at http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/index.html.

为了与你的web应用tuckey的工作,你需要声明添加到您的应用程序web.xml文件。从技术上讲,这意味着修改应用程序,但它是微创。如果你甚至不能触摸web.xml中由于某种原因(不知道为什么),我似乎记得的方式从外部强加在Tomcat中web应用程序的过滤器(不是阀),但远没有这回事pretty

To make tuckey work with your webapp, you would need to add declarations to your apps' web.xml. Technically this means "modifying the applications", but it is minimally invasive. If you can't even touch the web.xml for some reason (not sure why), I seem to recall a way to externally impose a filter (not a valve) on a webapp in Tomcat, but that's going pretty far.