tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Multiple context paths for single deployment
Date Fri, 13 May 2011 15:17:20 GMT
JanAa wrote:
> Thanks for replying.
> I was under the impression that the difference between
> HttpServletRequest.getContextPath and ServletContext.getContextPath() was
> exactly that the first returned the context path used in the request while
> the second returned the context path used when processing
> (
> I realise I have to find another route, I still need multiple urls to one
> application, and I have to identify these in the code. I am thinking about
> an urlrewritefilter that sets a request-attribute, and then use an
> outbound-rule to not show this to the users. Any other/better proposal?
How about this :
- deploy your application as the ROOT (default) application
- create a Servlet Filter, which wraps the request in a HttpServletRequestWrapper
- the HttpServletRequestWrapper redefines the getContextPah method
- your getContextPath returns whatever you want, in function of the original request URL
That would be independent of the servlet engine version.
I'd still have a look at the above solution with urlrewritefilter though, because it can 
do many other things in addition to what you mention above, and you do not need to write it.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message