Tomcat Notes: Deployment File

This is a personal study notes of Apache Tomcat. Below are main reference material.

  • [1、Tomcat deployment](#1、Tomcat deployment)

1、Tomcat deployment

1.1、Two modes of deployment

We know all apps we want to deploy should be placed in webappsfolder. Assuming predsis the app in the following notes.

we can see it has predsand preds.war.

Actually predsis 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.shor startup.batto 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, .jsand so on.

They are under the fisrt level folder. In below example styles.cssand ajax.xhtmlare 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-INFhas three types of files. They are configuration, complied files defined by developer and archived code.

  • Configuration files: Configuration file are under WEB-INF, like web.xmland faces-config.xmlin this example. Default configuration file is web.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 classfolder.

In this example you can see complied .javafiles which are .classfiles are under classfolder.

1.2.3、META-INF

It only contains a file called MANIFEST.MFwhich is used to record meta data which is description of the whole .warfile like what the .warfile 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

相关推荐
小鑫记得努力7 分钟前
Java类和对象(下篇)
java
binishuaio11 分钟前
Java 第11天 (git版本控制器基础用法)
java·开发语言·git
zz.YE13 分钟前
【Java SE】StringBuffer
java·开发语言
老友@13 分钟前
aspose如何获取PPT放映页“切换”的“持续时间”值
java·powerpoint·aspose
wrx繁星点点28 分钟前
状态模式(State Pattern)详解
java·开发语言·ui·设计模式·状态模式
Upaaui31 分钟前
Aop+自定义注解实现数据字典映射
java
zzzgd81631 分钟前
easyexcel实现自定义的策略类, 最后追加错误提示列, 自适应列宽,自动合并重复单元格, 美化表头
java·excel·表格·easyexcel·导入导出
友善的鸡蛋32 分钟前
解决:使用EasyExcel导入Excel模板时出现数据导入不进去的问题
java·easyexcel·excel导入
星沁城33 分钟前
240. 搜索二维矩阵 II
java·线性代数·算法·leetcode·矩阵
NoneCoder1 小时前
Java企业级开发系列(1)
java·开发语言·spring·团队开发·开发