tomcat 架构、源码学习(二)

接 tomcat 架构、源码学习(一)

10. tomcat中的容器Container。包括Engine,Host,Context,Wrapper

      一个Wrapper对应一个servlet,以及servlet的filter?

11. Wrapper    SimpleWrapper implements Wrapper, PipeLine。

      BasicValue有:SimpleWrapperValue(处于Pipeline链中的末端,不再调用nextInvoke方法。执行Loader and invoke servlet的service方法);

      ClientIPLoggerValue(第一行调用nextInvoke执行value链,之后在控制台输出客户端ip)

      HeaderLoggerValue(第一行调用nextInvoke执行value链,之后在控制台输出http请求头信息)

12. Mapper 存在于tomcat4中,tomcat5是什么? 《》

13.Container的调用过程:

     1)每一个Container包含一个pipeline。container的invoke方法调用pipeline中的invoke方法。

     2)pipeline中的invoke方法执行所有的加入Container对象中的value的invoke方法,然后调用basic value的invoke方法。

     3)在一个Wrapper中,basic value负责加载相关联的servlet类,并响应该request。

     4)在一个包含子containers的context中,basic value使用一个mapper去查找对应的子container来处理请求。如果能找到,就调用其invoke方法, 然后转到步骤1处。

猜你喜欢

转载自doti.iteye.com/blog/1553402