the element structure of Tomcat
1. Tomcat consists of a series of configurable components, the core of which is the servlet container component, which is the top-level container for all other Tomcat components, and 2, each component of Tomcat can be in the <catalina_home>/conf/ Server.xml "file, each Tomcat component corresponds to a configuration element in Server.xml, the following is a typical structure of a server.xml:
1
<Server>
2
<Service>
3
<connector/>
4
<Engine>
5
<Host>
6
<Context>
7
</Context>
8
</Host>
9
</Engine>
10
</Service>
11
</Server>
The elements in the configuration file can be divided into the following 4 categories:
1) Top class elements: including <Server><Service>;<server>: Represents the entire servlet container component, which is the top-level element of Tomcat and can contain one or more <Service>;
<service>: Contains a <Engine> and one or more <connector>, and these <Connector> share a <Engine>;
2) Connector class element: for <Connector>;<connector>: Represents a communication interface between the client and the server, responsible for sending the client's request to the server and returning the server's response to the customer;
3) Container class elements: 4 classes <Engine><Host><Context><Cluster><ENGINE>: Handle all <Connector> received customer requests from the same <Servcie>;
<context>: The most frequently used element, each <Context> represents a single Web application running on a virtual host, and a <Host> can contain multiple <Context>;
4) Nested class containerRepresents components that can be embedded in a container, such as <Value> and <Realm>;
Tomcat's directory structureThe following is a subdirectory of the Tomcat installation directory that will feature
/bin |
Store startup and shutdown Tomcat control scripts |
/conf |
Store tomcat various configuration files, which are more commonly used by server.xml |
/lib
|
Jar files that are accessible to both the Tomcat server and all Web applications |
/logs |
Log files that hold Tomcat |
/webapps |
When publishing a Javaweb program on Tomcat, the Web application is stored in this directory by default |
/work |
Tomcat's working directory, Tomcat stores some of the runtime's working files in this directory, as by default, Tomcat stores JSP-compiled Servelet class files in this directory |
A typical Java Web application directory structure (stored in the WebApps root directory, assuming the project name is DemoApp) 1
/webapps
2
|--demoapp
3
4
|--mypackage
5
|--dispatcherservlet.java
6
|--hellotag.java
7
|--web-inf
8
|--web.xml
9
|--mytaglib
10
|--classes
11
|--mypackage
12
|--dispatcherservlet.class
13
|--hellotag.class
14