Specify the web application path in META-INF / context.xml?

I am trying to change the path of a deployed war file in Tomcat. Reading the documentation, I cannot understand if this is possible without moving the context file to the / conf directory.

Is it possible to deploy a war file without an external context file (outside the war) and set the path to / something

Hooray! Thomas

+4
source share
1 answer

There are various ways to deploy a web application to the file system:

  • Copy your WAR file or the directory of your web application (including all its content) into the $ CATALINA_BASE / webapps directory.

  • Create the XML fragment file using only the Context element for your web application and put this XML file in $ CATALINA_BASE / webapps. Then the web application can be saved anywhere in your file system.

If you have a WAR file, you can expand it by simply copying the WAR file to the CATALINA_BASE / webapps directory. The file name must end with the extension ".war". When Tomcat notices a file, it (by default) decompresses it into a subdirectory with the base name of the WAR file . Then it will create a context in memory, as if you created it by editing the Tomcat server.xml file. However, any required default values ​​will be obtained from the DefaultContext element in the Tomcat server.xml file.

Another way to deploy a web application is to write a Context XML fragment file and deploy it to the CATALINA_BASE / webapps directory . A context fragment is not a complete XML document, but only one context element and any subelements suitable for your web application. These files are similar to context items cut from the server.xml file, and therefore the name "context fragment".

Taken from: Ten Tips for Setting Up Tomcat

Working with an XML interface will hopefully do what you want!

Regards, Christian

+2
source

All Articles