tags:

views:

38

answers:

1

Is it possible to specify multiple context paths for a single web application? For example I have a tomcat application myapp which runs on port 8080. I want to front this with apache such that localhost/app1 or localhost/app2 both are routed to myapp in tomcat How to achieve this?I don't want to use a redirect

+1  A: 

No. There is no way to define 2 paths for the same app. You can specify 2 paths for the same WAR but it will still be 2 instances of the same application.

However, you can define your application as ROOT and check the path in your code. For example, put your application in webapps/ROOT and add this logic to your servlets,

String path = request.getPathInfo();

if (path.indexOf("/app1") >= 0)
   app1(request, response);
else if (path.indexOf("/app2") >= 0)
   app2(request, response);
ZZ Coder
Hi Thanks for the response.but I don't want to modify my application but would want to modify httpd.conf so that it routes the request to tomcat
mithra