1. 总体概念
tomcat作用可以简单概括成:通过接收到的请求寻找到对应的servlet。
tomcat把功能的实现分解成两个大块:connector和container。
connectors:负责请求的接收并转发给container
container:管理整个项目。具体对请求处理是丢给了Valve。
2. 主要接口
与server.xml中的配置相关
- Server/Service:
- Engine/Host/Context/Wrapper(与Server/Service区分开,是因为它们继承了Container接口,能够接收并处理请求)
It is useful in the following types of scenarios:
You wish to use Interceptors that see every single request processed by the entire engine.
You wish to run Catalina in with a standalone HTTP connector, but still want support for multiple virtual hosts.
Host:代表虚拟主机,具体用处如下:It is useful in the following types of scenarios:
You wish to use Interceptors that see every single request processedby this particular virtual host.
You wish to run Catalina in with a standalone HTTP connector, but still want support for multiple virtual hosts.
Context:代表servlet context。- Connector
- Valve
- ServletRequest/ServletResponse
- Container
- Lifecycle