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 c开发者_开发问答hange the original name of the application('MyApplication').
Thanks, Abhishek.
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?
精彩评论