2023.04.22 Tomcat9.0.71源码解析
2023-04-23 09:18:09 3 举报
Tomcat架构及源码解析
作者其他创作
大纲/内容
Request Process Flowhttps://tomcat.apache.org/tomcat-9.0-doc/architecture/requestProcess.html
Tomcat架构-请求处理流程
Engine
自动配置加载流程-TomcatServletWebServerFactory1、启动时,根据以下时序图加载ServletWebServerFactoryAutoConfiguration2、通过@Import({ServletWebServerFactoryConfiguration.EmbeddedTomcat.class})加载EmbeddedTomcat3、ServletWebServerFactoryConfiguration中通过@Bean声明了TomcatServletWebServerFactory
NioEndpoint
官网b style=\
ConnectorCoyote HTTP/1.1
Service
Acceptor
Poller
Host
Apache Tomcat Development||\\/Architecture
Contextpath=\"/project\"
Context
AsyncTimeout
Tomcat架构-启动流程
Socket
对应版本的Documentation文档:https://tomcat.apache.org/tomcat-9.0-doc/index.html
Tomcat架构
NioSocketWrapper
Hostwww.tecchen.tech
endpoint.setSocketOptions(socket)
8005
Hostlocalhost
Realm
addEvent(pollerEvent)
Executor
Service 2
官网:https://tomcat.apache.org/
Architecture Overviewhttps://tomcat.apache.org/tomcat-9.0-doc/architecture/overview.html
Tomcat
StandardWrapperValve.container->StandardWrapper.instance->DispatcherServletRequest.mappingData->StandardWrapper.instance->DispatcherServlet# 接收请求org.apache.tomcat.util.net.NioEndpoint.Poller#run
socket = endpoint.serverSocketAccept();
Endpoint
请求处理流程时序图:https://tomcat.apache.org/tomcat-9.0-doc/architecture/requestProcess/request-process.png
连接器 Connector监听网络端口;接受网络请求;读取网络字节流;根据应用层协议解析字节流,生成统一的 tomcat request 和 tomcat response 对象;将 tomcat request 对象转成 servletRequest;调用 servlet 容器,得到 servletResponse;将 servletResponse 转成 tomcat response;将 tomcat response 转成网络字节流;将响应字节流写回给浏览器;
Processor
8009
Handler
TCP
8080
Server
Startuphttps://tomcat.apache.org/tomcat-9.0-doc/architecture/startup.html
ServiceTomcat-standalone
Contextpath=\"/service\"
Listener
poller.register(socketWrapper)
Adapter
⭐️2023.04.23 SpringBoot自动配置源码解析https://www.processon.com/view/link/6444f93b84b4b71c14ff3fa3
Connector HTTP connector AJP connector
Connector HTTP connector AJP connectorAPR (HTTP/AJP) Connector
SendfileData
认证处理流程时序图:https://tomcat.apache.org/tomcat-9.0-doc/architecture/requestProcess/authentication-process.png
SocketProcessor
PollerEvent
Valve
Connector HTTP connector AJP connector
官方架构文档
ConnectorCoyote JK2
GlobalNamingResources
Wrapper Servlet
ProtocolHandler
参考链接:https://www.cnblogs.com/sglx/p/15423671.htmlhttps://www.suibibk.com/topic/947212037660868608https://www.cnblogs.com/yishi-san/category/2203390.htmlhttps://www.modb.pro/db/61573
官方启动时序图:https://tomcat.apache.org/tomcat-9.0-doc/architecture/startup/serverStartup.pdf
Wrapper Servlet
Tomcat架构-总览
Request
Wrapper Servlet
Tomcat9.0.71源码解析版本 vspan style=\
0 条评论
下一页