Tomcat component


First, download from the official website tomcat 9.0.27 source package, and then in the corresponding directory execute the ant command will download the required dependencies. The source of the eclipse in the introduction, the ant downloaded jar package dependencies in buildPath added to, and then jre / lib / jce.jar also added to it, the main method of performing Bootstrap start tomcat.

Package

    • Server interface is a "server component", which is responsible for starting the server, terminated.
    • Service interface is the "service component", which is responsible for load connector, the connector assembly connected to the container.
    • Engine interface is a servlet engine, which is responsible for initialization / start under the container, and the initialization / start connector assembly.
    • Host interface is a virtual host component, which is responsible for intercepting filter requests, its life cycle listeners HostConfig be war files for deployment.
    • Context represents a specific Web application, its life cycle listeners ContextListener property will be configured.
    • Wrapper on behalf of a specific Servlet, which is responsible for managing the corresponding Servlet's lifecycle.

Components details 

Tomcat structure

 

Server

Representative of the Catalina Servlet container. Server is not a Container, it does not implement interfaces or extend ContainerBase Container class, but it has a life cycle. Server to start, stop, Catalina, its address attribute specifies the address monitor command, port attribute specifies the port monitor command (the default code is 8005). The default implementation class is StandardServer

 

 

 

Service

Connector allows multiple shared a Container (ie Engine). Service is not a Container, it only implements the Lifecycle interface. A Server can have multiple Service, they are independent of each Service, but share Jar on the JVM and class path. The default implementation class Service is StandardService.

 

 

 

container

 

Tomcat total of four containers, are Engine, Host, Context, and Wrapper. The relationship between the upper container to the lower container are many.

 

Engine

 

 

 

 Engine is representative of the Catalina Servlet engine. Engine can 1) is provided as a separate request to the processor; 2) supporting a plurality of virtual host (Host). Engine subordinate container may also be a Host Context, but generally do not Engine to deploy the web application (Context). Since the Engine is the top of the container, so call its setParent method throws IllegalArgumentException. The default implementation class is StandardEngine.

 

Host

 

 

 It represents a virtual host. The lower layer containers are typically Context. The default implementation class is StandardHost.

 

Context

 

 

 Representative Servlet context, i.e. a web application. The default implementation class is StandardContext.

 ContextBind interface is used to change a web application ClassLoader.

 

Wrapper

 

 

Servlet is a separate package, is responsible for managing the life cycle of Servlet and distribution. The default implementation class is StandardWrapper.

 

Guess you like

Origin www.cnblogs.com/Logan12138/p/12003129.html
Recommended