Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Short url or alias for deployed application in tomcat 6

I have a web application project which is deployed in tomcat 6. I can access my application using the url:

http://localhost:8082/MyApplication

I also wan't to be able to access this application by another url like: http://localhost:8082/myapp

Is this possible ? if yes what alternatives do i have ?

Off course, I don't want to change the original name of the application('MyApplication').

Thanks, Abhishek.

like image 887
Abhishek Avatar asked Nov 10 '10 11:11

Abhishek


1 Answers

If you add the Context within server.xml it will work as you want. Give the path attribute you wish.

<Context docBase="MyApplication" path="/myapp" /> 

Though it works, this approach is not recommended by the Tomcat docs, since any changes to server.xml means restarting the server disturbing all the web apps.

But, on the flip side, the practice of keeping this in Catalina_Home/conf/Catalina/localhost/context.xml (which is recommended by the docs) has some unreliabilities as others have reported - when you redeploy the war you can lose the context.xml too

See Why-does-tomcat-replace-context-xml-on-redeploy and Why does tomcat like deleting my context.xml file?

like image 118
JoseK Avatar answered Sep 22 '22 02:09

JoseK