wood burning stoves*
The moose likes Tomcat and the fly likes Redirecting context paths in Tomcat 5.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Redirecting context paths in Tomcat 5.5" Watch "Redirecting context paths in Tomcat 5.5" New topic
Author

Redirecting context paths in Tomcat 5.5

Renato Losio
Ranch Hand

Joined: Nov 23, 2005
Posts: 99
Hello.

I have a Tomcat 5.5 running on myserver.com:8080 behind an Apache on port 80.

I have two application under webapps with the following context path:

webapps/app1<Context path=""
webapps/app2<Context path="/app2"

So app1 takes care of every request but:

http://myserver.com/app2/(...)

I have now a new requirement that:

http://myserver.com/newurl

should be forwarded to:

http://myserver.com/app2/

or even better:

http://myserver.com/app2/newurl

I have no control of the Apache server and I cannot change its configuration. Moreover:

Sessions (cookies and URL rewriting as well) should not be affected.

Only /newurl should go under /app2, everthing else (for example /morenewurl) should be not affected and go under /app1

Any idea how I can achieve that?

cheers

renato


Renato Losio - www.arsenio.it - renatoweb@arsenio.it
Renato Losio
Ranch Hand

Joined: Nov 23, 2005
Posts: 99
Hello.

I was able to get what I wanted adding a filter in the app1. All the requests for /newurl are now redirected to /app2/newurl using:






I had to add:




in the app1.xml as well. It works but I'm just wandering if there is a better solution.

cheers

renato
 
Don't get me started about those stupid light bulbs.
 
subject: Redirecting context paths in Tomcat 5.5