This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Redirecting context paths in Tomcat 5.5
 
Similar Threads
Apache 1.3 / Tomcat 4.0 Configuration Problem
Apache & Tomcat problem
Problem with referencing session information from 2 contexts, one a subfolder of another
Multiple apps in Tomcat
2 Virt Host : dual personalities?