Tomcat Notes: Deployment File
This is a personal study notes of Apache Tomcat. Below are main reference material.
- YouTube Apache Tomcat Full Tutorial,owed by Alpha Brains Courses. https://www.youtube.com/watch?v=rElJIPRw5iM&t=801s
1、Tomcat deployment
1.1、Two modes of deployment
We know all apps we want to deploy should be placed in webapps
folder. Assuming preds
is the app in the following notes.
we can see it has preds
and preds.war
.
Actually preds
is the unpacked version of preds.war
. They have exactly same content.
it reveals that Tomcat support two modes of deployment:
- packed: The entire app is packed in a war file, like
preds.war
. - unpacked: A normal folder, unpacked version of
preds.war
.
So you can have only one of them then execute startup.sh
or startup.bat
to get app deployed.
We usually choose packed file to deploy. It’s for portability: Packed file is only one file. It’s easy to copy or transfer unlike a directory to mess around with.
1.2、deployment file structure
1.2.1、Static files
Static files are like .html
, .css
, .jsp
, .js
and so on.
They are under the fisrt level folder. In below example styles.css
and ajax.xhtml
are static files.
You can also create a subdirectory of your own to place static files. It’s very common like image files placed under preds.war/assets/images/
.
1.2.2、WEB-INF
WEB-INF
has three types of files. They are configuration, complied files defined by developer and archived code.
- Configuration files: Configuration file are under
WEB-INF
, likeweb.xml
andfaces-config.xml
in this example. Default configuration file isweb.xml
. You can configure web context, welcome page and so on in this file.
Compiled files defined by developers also are placed in WEB-INF
, which are under class
folder.
In this example you can see complied .java
files which are .class
files are under class
folder.
1.2.3、META-INF
It only contains a file called MANIFEST.MF
which is used to record meta data which is description of the whole .war
file like what the .war
file have and where those files are placed.
Basically it used to make sure everything is in the right place. Just know what is used for is ok.
1.2.4、Summary
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!