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

相关推荐
朝新_6 分钟前
【SpringBoot】玩转 Spring Boot 日志:级别划分、持久化、格式配置及 Lombok 简化使用
java·spring boot·笔记·后端·spring·javaee
m0_7482480213 分钟前
Spring设计模式刨根问底
java·spring·设计模式
喝杯牛奶丶15 分钟前
MySQL隔离级别:大厂为何偏爱RC?
java·数据库·mysql·面试
一 乐21 分钟前
二手车销售|汽车销售|基于SprinBoot+vue的二手车交易系统(源码+数据库+文档)
java·前端·数据库·vue.js·后端·汽车
Mos_x1 小时前
15.<Spring Boot 日志>
java·后端
mm-q29152227291 小时前
Java并发编程从入门到进阶 多场景实战
java·开发语言
Violet_YSWY1 小时前
任何数据结构的构造或初始化,都应指定大小,避免数据结构无限增长吃光内存【示例】
java·数据结构
SimonKing1 小时前
你的项目还在用MyBatis吗?或许这个框架更适合你:Easy-Query
java·后端·程序员
nice_lcj5201 小时前
认识多线程:单例模式
java·开发语言·单例模式
货拉拉技术1 小时前
从代码到配置:如何用SQL配置实现数据核对
java·后端