开发者

Set the path of web app in META-INF/context.xml?

开发者 https://www.devze.com 2022-12-12 08:24 出处:网络
I\'m tryin to change the path of a deployed war file in Tomcat. Reading the documentation I can\'t figure out if this is possible without moving the context-file开发者_高级运维 to the /conf directory.

I'm tryin to change the path of a deployed war file in Tomcat. Reading the documentation I can't figure out if this is possible without moving the context-file开发者_高级运维 to the /conf directory.

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

Cheers! Tomas


there are different ways of deploying a web application on the filesystem:

  1. Copy your WAR file or your web application's directory (including all of its content) to the $CATALINA_BASE/webapps directory.

  2. Create an XML fragment file with just the Context element for your web application, and place this XML file in $CATALINA_BASE/webapps. The web application itself can then be stored anywhere on your filesystem.

If you have a WAR file, you can deploy it by simply copying the WAR file into the directory CATALINA_BASE/webapps. The filename must end with an extension of ".war". Once Tomcat notices the file, it will (by default) unpack it into a subdirectory with the base name of the WAR file. It will then create a context in memory, just as though you had created one by editing Tomcat's server.xml file. However, any necessary defaults will be obtained from the DefaultContext element in Tomcat's server.xml file.

Another way to deploy a web app is by writing a Context XML fragment file and deploying it into the CATALINA_BASE/webapps directory. A context fragment is not a complete XML document, but just one Context element and any subelements that are appropriate for your web application. These files are like Context elements cut out of the server.xml file, hence the name "context fragment."

Taken from: Top Ten Tomcat Configuration Tips

Working with the Context XML will hopefully do what you want!

Regards, Christian

0

精彩评论

暂无评论...
验证码 换一张
取 消