日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

tomact如何处理一个http请求?

發(fā)布時(shí)間:2025/4/5 编程问答 14 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tomact如何处理一个http请求? 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

tomcat 從http 端口接收到一個(gè)請(qǐng)求后:

1.

2.

3.


Tomcat receives a request on an HTTP portd1) The request is received by a separate thread which is waiting in the PoolTcpEndPoint class. It is waiting for a request in a regular ServerSocket.accept() method.When a request is received, this thread wakes up.d2) The PoolTcpEndPoint assigns the a TcpConnection to handle the request. It also supplies a JMX object name to the catalina container (not used I believe)d3) The processor to handle the request in this case is Coyote Http11Processor, and the process method is invoked.This same processor is also continuing to check the input stream of the socketuntil the keep alive point is reached or the connection is disconnected.d4) The HTTP request is parsed using an internal buffer class (Coyote Http11 Internal Buffer)The buffer class parses the request line, the headers, etc and store the result in a Coyote request (not an HTTP request) This request contains all the HTTP info, suchas servername, port, scheme, etc.d5) The processor contains a reference to an Adapter, in this case it is the Coyote Tomcat 5 Adapter. Once the request has been parsed, the Http11 processorinvokes service() on the adapter. In the service method, the Request contains a CoyoteRequest and CoyoteRespons (null for the first time)The CoyoteRequest(Response) implements HttpRequest(Response) and HttpServletRequest(Response)The adapter parses and associates everything with the request, cookies, the context through a Mapper, etcd6) When the parsing is finished, the CoyoteAdapter invokes its container (StandardEngine)and invokes the invoke(request,response) method.This initiates the HTTP request into the Catalina container starting at the engine leveld7) The StandardEngine.invoke() simply invokes the container pipeline.invoke()d8) By default the engine only has one valve the StandardEngineValve, this valve simplyinvokes the invoke() method on the Host pipeline (StandardHost.getPipeLine())d9) the StandardHost has two valves by default, the StandardHostValve and the ErrorReportValved10) The standard host valve associates the correct class loader with the current threadIt also retrieves the Manager and the session associated with the request (if there is one)If there is a session access() is called to keep the session alived11) After that the StandardHostValve invokes the pipeline on the context associatedwith the request.d12) The first valve that gets invoked by the Context pipeline is the FormAuthenticatorvalve. Then the StandardContextValve gets invoke.The StandardContextValve invokes any context listeners associated with the context.Next it invokes the pipeline on the Wrapper component (StandardWrapperValve)d13) During the invocation of the StandardWrapperValve, the JSP wrapper (Jasper) gets invokedThis results in the actual compilation of the JSP.And then invokes the actual servlet.e) Invocation of the servlet class

轉(zhuǎn)載于:https://www.cnblogs.com/davidwang456/archive/2013/03/23/2976635.html

總結(jié)

以上是生活随笔為你收集整理的tomact如何处理一个http请求?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。