tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: multiple URI
Date Wed, 20 Jan 2010 14:37:16 GMT
Vadym Chepkov wrote:
> Unfortunately, I have to install such application in ROOT context for this to work and
I am trying to avoid it.
> 
I think Chuck pointed you to one way of achieving this, using the 
UrlRewriteFilter module (www.tuckey.org).  That is a third-party Tomcat 
add-on module (free) which functions as a servlet filter (meaning it 
works on any servlet engine, not only Tomcat), and fills a role similar 
to the Apache httpd mod_rewrite module.

Basically, the filter catches a request early (before the servlets see 
it), examines it, and according to configurable parameters, rewrites the 
URL and forwards it to another webapp (or not).

Unfortunately, I don't know enough myself to show you exactly how to set 
this up, but my guess would be something like :

- suppose for now that you set up your webapp (the one you wish to use 
to handle requests to /A or /B), under tomcat/webapps/xyz

- then in the web.xml of the existing ROOT application, add the 
configuration for the UrlRewriteFilter.
You want it to check the URL for requests to either /A/* or /B/*, and if 
it matches, then rewrite the URL to /xyz/A/* or /xyz/B/* (for instance) 
and re-direct this request to your webapp.
If it does not match, then you do nothing (and let the request filter 
down to the normal ROOT app).

- now comes the tricky bit of which I am not sure : how do you set up 
your webapp/servlet, so that it will process these /xyz/* URLs, as 
re-directed by the filter, and without itself receiving the requests for 
/xyz directly ?
I believe for that you have to set it up somewhere else than under 
/tomcat/webapps, and then tell Tomcat, separately, where to find it.
But that's where my knowledge ends and someone else should take over.
Of course you have to set up your webapp to handle the URLs /xyz/A* and 
/xyz/B*. But the previous post showed you how to do that.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message