• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

tomcat web application root context

 
Greenhorn
Posts: 28
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

I have an issue with my web application's root context URL.
I use maven to build the war file and i get the war file with the name WebApp-0.0.1-SNAPSHOT.war
I can only access the application with the URL http://domain:8080/WebApp-0.0.1-SNAPSHOT/faces/secured/index.xhtml
But i want to access it in a consistent way like http://domain:8080/WebApp/faces/secured/index.xhtml
how to keep the root context url consistent.

thanks
Aadil
 
Bartender
Posts: 20984
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you copy the WAR into the TOMCAT_HOME/webapps directory, the context path will be the same as the name of the WAR (minus the ".war" extension).

If you create a Context XML file in TOMCAT_HOME/conf/Catalina/localhost, the context path will be the name of the Context XML file (minus the ".xml" extension). But you would have to update the docBase attribute to point to the current version of the WAR

For testing, I don't bother building a WAR file, i just point the docBase of my context XML file to my project's Maven target directory, where the exploded version of the WAR is built (and zipped from) in the subdirectory whose name matches the project. So there's neither major nor snapshot version names that have to be changed.

 
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!