隨筆 - 53, 文章 - 0, 評論 - 3, 引用 - 0
          數據加載中……

          Tomcat Source Code Reading

          0. I am reading the source code of Tomcat 6.0.26. To pay off the effort,
          I documents some notes for record. Thanks for the articles about Tomcat
          source code, especially the book <<How Tomcat works>>.

          1. They are two concepts about server, one is called Server, which
          is for managing the Tomcat (start and stop); another is called Connector,
          which is the server to serve the application request. they are on the different
          ports. The server.xml clearly show the difference.

          <Server port="8005" shutdown="SHUTDOWN">
            <Service name="Catalina">
              <Connector port="8080" protocol="HTTP/1.1"
                         connectionTimeout="20000"
                         redirectPort="8443" />
              <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

          although the server is the top level element, logically it should not be.
          Actually in code, Bootstrap starts the service first, which
          in turn start the Server and server's services.

          2. My focus in on Connector part. I care how the request is services by the
          Tomcat. Here are some key classes.

          Connector --> ProtocolHandler (HttpProtocol
                                  and AjpProtocol)                       --> JIoEndPoint
                                                                                     --> Handler(Http11ConnectionHandler
                                                                                     and AjpConnectionHandler)
                                                            
                                                            
          3. Connector is most obervious class, but the entry point is not here.
          The sequence is like this.

          Connector.Acceptor.run()
          --> JioEndPoint.processSocke(Socket socket)
              -->SockeProcess.run()
                  -->Http11ConnectorHandler.process(Socket socket)
                      -->Http11Processor.process(Socket socket)
                          -->CoyoteAdapter.service(Request req, Response res)       

          The core logic is in method Http11Processor.process(Socket socket)                                                  

          CoyoteAdapter.service(Request req, Response res) bridges between Connector module and Container module.

          Any comments are welcome. I may continue the source code reading and dig deeper into it if time permit.


          posted on 2010-03-30 17:11 InPractice 閱讀(616) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 安康市| 云南省| 兴仁县| 五原县| 缙云县| 互助| 高要市| 玛纳斯县| 陇川县| 商南县| 英吉沙县| 晋中市| 翁牛特旗| 通辽市| 绥化市| 平阳县| 泰和县| 尚义县| 密云县| 乌什县| 江口县| 万载县| 元氏县| 仲巴县| 咸宁市| 山东省| 西安市| 苏尼特右旗| 泽州县| 余庆县| 嘉荫县| 儋州市| 牙克石市| 成武县| 家居| 新巴尔虎左旗| 江达县| 呼和浩特市| 吉安市| 民权县| 永泰县|