What does Tomcat do with unpacked directory after deploying a war?

So, I've deployed a Java web application (myapp.war) to a Tomcat 7 server that happens to be running on Amazon EC2. I noticed that, when I do this, it overwrites a similarly-named directory called myapp when I deploy. I further realized that the app is actually being served from that myapp directory and, when I directly make a change to a file in that directory, the changes are served to the client as expected.

My question is does Tomcat do anything to this directory between redeployments? If I make a small change in a file in that directory, will it ever be overwritten before I redeploy again?


It depends.

Changes to class files will probably be ignored.

Changes to JSPs may take effect depending on if the JSP has already been accessed and if the JSP Servlet is configured to check for changes.

Changes to static files will probably take effect but may be delayed by the effects of the static file cache. Normally that delay is only a few seconds but it can be configured to be longer.

Editing web.xml will probably trigger a reload (again this can be disabled with config)

Editing contex.xml will probably trigger a redeploy.

A reload pauses the app, re-reads web.xml and unpauses the app so the user might see a short pause but no 404s. A redploy completely removes the old app and creates a new one. A user may see a 404 in they try accessing it at the wrong time.

As soon as a new WAR file is deployed, all local changes will be lost.

链接地址: http://www.djcxy.com/p/55892.html

上一篇: Grails生产.War部署

下一篇: 部署战争后,Tomcat在解压目录时做了什么?