Tomcat server principles

Source: Internet
Author: User
Composition:

1. Server represents the entire Catalina serverlet container

2. Service: composed of one or more ctor and one shared engine Processing Engine

3. connector listens to customer requests on the specified port and sends the requests to the engine for processing (coyote HTTP and coyotejk2)

4. the engine must be configured under the service component. The engine can be configured with multiple virtual hosts.

5. Host represents a virtual host. One or more web applications are configured under each virtual host. Each web application corresponds to a context and has a context path.

6. When the context is created, load the servlet according to $ catalina_home/CONF/Web. xml and $ webapp/Web-INF/Web. xml

Loader:

How to place class and resource files
A. corresponding to a web application: the jar of the class under the web-INF/classes of the Web application is placed under the web-INF/lib

B. corresponds to multiple Web applications: class is placed in the $ catalina_home/shared/class directory.

Tomcat class loading (classloader ):
Bootstrap ($ java_home/JRE/lib/EXT/*. Jar)
System ($ classpath/*. Class and specified jar)
Common (three subdirectories under $ catalina_home/common: classes, Lib, and endores)
Catalina (the classes and Lib directories under $ catalina_home/Server/are only visible to Tomcat)
& Shared (the classes and Lib directories under $ catalina_home/shared/and the $ catalina_home/lib directory) only applies to Web ApplicationsProgramVisible, invisible to Tomcat
Webapp ($ webapp/Web-INF/* only visible to this Web application classes/*. Class lib/*. Jar)

For Web applications, the order of loading classes and resources is:

/Web-INF/classes -->/Web-INF/lib/*. jar --> Bootstrap --> System --> $ catalina_home/common/classes
--> $ Catalina_home/common/endores/*. jar --> $ catalina_home/common/lib/*. jar --> $ catalina_home/shared/classes
--> $ Catalina_home/shared/lib/*. Jar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.