Tomcat笔记

Catalina - org.apache.catalina.startup.Catalina
    Server - org.apache.catalina.core.StandardServer
        Service - org.apache.catalina.core.StandardService
            Connector - org.apache.catalina.connector.Connector                                                    此部分根据不同请求协议为不同实现,以下为Nio方式实现Http1.1协议
                +---------------------------------------------------------------------------------------------------------------------------------------------------------------+
                |ProtocolHandler - org.apache.coyote.http11.Http11NioProtocol
                |   AbstractEndpoint - org.apache.tomcat.util.net.NioEndpoint
                |       Acceptor - org.apache.tomcat.util.net.Acceptor - 接收socket请求
                |       NioEndpoint.Poller - org.apache.tomcat.util.net.NioEndpoint.Poller - NioSelector
                |   AbstractEndpoint.Handler - org.apache.coyote.AbstractProtocol.ConnectionHandler - NioHandler - 调用Processor处理socket请求
                |   Processor - org.apache.coyote.http11.Http11Processor - 从socket中获取请求数据并封装为Servlet请求、调用Adapter处理请求
                +---------------------------------------------------------------------------------------------------------------------------------------------------------------+
                Adapter - org.apache.catalina.connector.CoyoteAdapter - 根据Servlet请求数据(url,method)匹配对应的Host、Context、Wrapper,并调用Engine责任链头开始处理数据
            Engine - org.apache.catalina.core.StandardEngine
                Pipeline - org.apache.catalina.core.StandardPipeline
                    Valve - org.apache.catalina.core.StandardEngineValve - 默认(最后一步)处理 - 调用Host的责任链头处理
                Host - org.apache.catalina.core.StandardHost
                    Pipeline - org.apache.catalina.core.StandardPipeline
                        Valve - org.apache.catalina.core.StandardHostValve - 默认(最后一步)处理 - 调用Context的责任链头处理
                    Context - org.apache.catalina.core.StandardContext
                        Pipeline - org.apache.catalina.core.StandardPipeline
                            Valve - org.apache.catalina.core.StandardContextValve - 默认(最后一步)处理 - 调用Wrapper的责任链头处理
                        Wrapper - org.apache.catalina.core.StandardWrapper
                            Pipeline - org.apache.catalina.core.StandardPipeline
                                Valve - org.apache.catalina.core.StandardWrapperValve - 默认(最后一步)处理 - 找到Servlet和FilterChain,调用FilterChain.doFilter
                            FilterChain - org.apache.catalina.core.ApplicationFilterChain - 依次调用Filter.doFilter。如果结束,调用Servlet.service
                            Servlet - javax.servlet.Servlet
01-07 18:40