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