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

相关推荐
未若君雅裁4 分钟前
LeetCode 18 - 四数之和 详解笔记
java·数据结构·笔记·算法·leetcode
Bug快跑-15 分钟前
Java、C# 和 C++ 并发编程的深度比较与应用场景
java·开发语言·前端
Moe48833 分钟前
ConcurrentHashMap 重要方法实现原理和源码解析(二)
java·后端
有梦想的攻城狮1 小时前
初识Rust语言
java·开发语言·rust
小虾米 ~1 小时前
RocketMQ DefaultMQPushConsumer vs DefaultLitePullConsumer
java·rocketmq·java-rocketmq
q***21601 小时前
【监控】spring actuator源码速读
java·spring boot·spring
Kuo-Teng1 小时前
LeetCode 142: Linked List Cycle II
java·算法·leetcode·链表·职场和发展
Moe4881 小时前
ConcurrentHashMap 重要方法实现原理和源码解析(一)
java·后端
拾忆,想起2 小时前
Dubbo核心架构全解析:构建微服务通信的高速公路
java·微服务·云原生·架构·dubbo·哈希算法
楠枬2 小时前
Spring Cloud 概述
java·spring cloud·微服务