image.png

    1. 用户访问localhost:8888/test/helloword.do,请求被发送到Tomcat,被监听8888端口并处理 HTTP/1.1 协议的Connector获得。
    2. Connector把该请求交给它所在的Service的Engine来处理,并等待Engine的回应。
    3. Engine获得请求localhost/test/helloword.do,匹配所有的虚拟主机Host。
    4. Engine匹配到名为localhost的Host虚拟主机来处理/test/helloword.do请求(即使匹配不到会请求交给默认Host处理)。
    5. 匹配到的Context获得请求/helloword.do。
    6. 构造HttpServletRequest对象和HttpServletResponse对象,作为参数调用HelloWorld的doGet()或doPost().执行业务逻辑、数据存储等程序。
    7. Context把执行完之后的结果通过HttpServletResponse对象返回给Host。
    8. Host把HttpServletResponse返回给Engine。
    9. Engine把HttpServletResponse对象返回Connector。
    10. Connector把HttpServletResponse对象返回给客户Browser。