理解Tomcat

Tomcat架构

Tomcat处理请求过程

1、用户访问http://localhost:8080/test/index.jsp,被监听8080端口并处理 HTTP/1.0 协议的的Connector获得;
2、Connector把该请求交给它所在的Service的Engine来处理,并等待Engine的回应;
3、Engine获得请求localhost/test/index.jsp ,匹配所有Host;
4、Engine 匹配到localhost的Host 虚拟主机来处理 /test/index.jsp请求(即使匹配不到也会交给默认的Host 来处理),
Host会根据/test 匹配它所拥有的所有Context。
5、匹配到的Context获得请求 /index.jsp;
6、够着HttpServletRequest 对象和HttpServletRespose对象,作为参数调用jspServelt的doGet()或doPost()
执行业务逻辑、数据存储等程序;
7、Context 把执行完的结果通过 HTTPServletResponse对象返回给Host;
8、Host 把HTTPServletResponse 返回给Engine;
9、Engine 把 HTTPServletResponse 返回给 Connector;
10、Connector 把 HTTPServletResponse 返回给 Browser。

posted @ 2020-06-06 13:03  行者老夫  阅读(188)  评论(0编辑  收藏  举报