概念
- 切换io类型;根据协议类型(http; ajp/1.3;)确定; 也就是在 server.xml <Connector 节点来设置,可以设置类名;tomcat 版本不同 有区别;
- 每个标签对应一个服务;StandardContext 类
- Wrapper 可以等价于Setvlet
- Constants 里边定义一些配置文件
- 一个 web.xml 对应一个WebXml 对象;
- ContextConfig 加载每个Servlet 的配置;
tomcat 核心架构图
---------------------------------------------------------------------------------------------------------
| server-1 |
| [Listener](多个) {Global Naming Resources[Resource](多个)} [jndi] |
| |
| ---------------------------------------------------------------------------------------------------- |
| | service-N | |
| | -----------------\ ------------------------------------------------------------------------ | |
| | | connector-N | | Engine-1 | | |
| | |[thread-pool] | | [Listener]-N [realm] | | |
-----http-->|-|-|--> | | | | |
-----ajp--->|-|-|--> | | | | |
-----https->|-|-|--> | | | | |
| | | | | ------------------------------------------------------------------ | | |
| | | | | | Host-N : [Listener]-N [realm] | | | |
| | | | | | | | | |
| | | | | | ------------------------------------------------------ | | | |
| | | | | | | Context-N: [manager] [loader] [Resource-Link] | | | | |
| | ------------------ | | | [Resouce] [Listener] [realm] | | | | |
| | | | | | ----------------------------------------------- | | | | |
| | | | | | | WebApp: [Filter]-N [Wrapper]-N [POJO]-N | | | | | |
| | | | | | | | | | | | | |
| | | | | | | [servlet] | | | | | |
| | | | | | ----------------------------------------------- | | | | |
| | | | | \----------------------------------------------------/ | | | |
| | | | ----------------------------------------------------------------/ | | |
| | | -----------------------------------------------------------------------/ | |
| | [executor] | |
| ---------------------------------------------------------------------------------------------------- |
---------------------------------------------------------------------------------------------------------
- connector -> servlet