Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirecting context paths in Tomcat 5.5

 
Renato Losio
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic