Legend has it that the user's request is received in Jioendpoint's accept function, which is the dividing point of tomact interaction with the outside world.

Source: Internet
Author: User
Tags wrapper

Legend has it that the user's request is received in Jioendpoint's accept function, which is the boundary point of tomact interaction with the outside world, so to study, "" "" "" "" "" "" "" "" "" "" "" "" "" "", "" "" "" "" "" "" "" "" "" "From the top-level interface:How ==================jioendpoint was pulled up ================ Public InterfaceProtocolhandler---》 Public Abstract classAbstractprotocol<s>Implementsprotocolhandler,mbeanregistration---》 Public Abstract classAbstractajpprotocol<s>extendsAbstractprotocol<s> {                        ---》 Public classAjpprotocolextendsAbstractajpprotocol<socket>Java.org.apache.coyote.ajp.AjpProtocol.AjpProtocol ()  PublicAjpprotocol () {endpoint=NewJioendpoint (); CHandler=NewAjpconnectionhandler ( This);                                    ((jioendpoint) endpoint). SetHandler (CHandler);                                    Setsolinger (Constants.default_connection_linger);                                    Setsotimeout (constants.default_connection_timeout);                                Settcpnodelay (Constants.default_tcp_no_delay); }   Public classJioendpointextendsAbstractendpoint<socket>JioendpointHow ==================jioendpoint was pulled up ================ ================jioendpoint processing request ==================Endpoint=NewJioendpoint (); ((jioendpoint) endpoint). SetHandler (CHandler); -----》 Public voidSetHandler (Handler Handler) { This. Handler =handler;} ------"CHandler =NewAjpconnectionhandler ( This);  This--"ajpprotocol--" abstractajpprotocol--"Abstractprotocol----------》voidJava.org.apache.coyote.AbstractProtocol.init ()throwsException---"Endpoint.init (); -------"Abstractendpoint.init ()---"bind (); ---》 Public Abstract voidBind ()throwsException; ----"Jioendpoint.bind () ServerSocket=Serversocketfactory.createsocket (Getport (), Getbacklog ()); ???who called it? Startinternal ()----->startacceptorthreads (); --->abstractendpoint.startacceptorthreads () acceptors[i]=Createacceptor ();                        T.start (); --->Jioendpointprotectedabstractendpoint.acceptor Createacceptor () {return Newacceptor (); }                ----------->Java.org.apache.tomcat.util.net.AbstractEndpoint.Acceptor---->Run ()--->Jioendpoint.processsocket (socket socket)-Getexecutor (). Execute (Newsocketprocessor (wrapper)); --->Socketprocessor---->Run ()--state =handler.process (socket, socketstatus.open_read); Handler====who's going to deal with it after Http11protocol?          The conclusion is that Jioendpoint is processed by invoking the process method of Http11connectionhandler.                                              Look online someone gave, I was not figured out, just guess, the last explanation in the last side given.                                                                              Http11processor {                                                                                                Http11protocol ()  PublicHttp11protocol () {endpoint=NewJioendpoint (); CHandler=NewHttp11connectionhandler ( This);                                                    ((jioendpoint) endpoint). SetHandler (CHandler);                                                    Setsolinger (Constants.default_connection_linger);                                                    Setsotimeout (constants.default_connection_timeout);                                                Settcpnodelay (Constants.default_tcp_no_delay); }                                                        ----------------"Http11connectionhandler---------------》protected Static classHttp11connectionhandlerextendsAbstractconnectionhandler<socket, http11processor>ImplementsHandler {} http11processor createprocessor () after the look                        Online, and then see Processor.setadapter (Proto.adapter); Adapter---"Coyoteadapter standardengin container default pipe standardenginvalve Standar Dhost---standardhostvalue Standardhostvalue Select the appropriate context container Standardcontext configured Standardcontextvalve by default            After that, select a suitable wrapper container.            The Standardwrapper container is configured with Standardwrappervalve by default. is to start the filter filterchain and perform a filter operation on the request. 2) Executes the service method. Add that the Standardwrapper container is for the servlet wrapper, all request resources can be divided into 4 different types, static resource requests (HTML, images, CSS, etc.), JSP requests, servlet requests,            and CGI requests. For different requests Tomcat handles the static resource file with Webdavservlet, Jspservlet processes the JSP request, and Cgiservlet handles the CGI request. ================jioendpoint Processing Request ================== ======= explanation ========guess because the HTTP protocol used is 1.1, so the last one to use is Http11protocol. Public InterfaceHandlerextendsthe Abstractendpoint.handler implementation class has the following Java.org.apache.coyote Abstractprotocol<S>Abstractconnectionhandler<s, p>(potential match) JAVA.ORG.APACHE.COYOTE.AJP Ajpaprprotocol Ajpnioprotocol AjpProtocoljava.org.apache.coyot E.HTTP11 http11aprprotocol Http11nioprotocol Http11Protocoljava.org.apache.naming.factory.webservices-servicereffactory Inithandlerchain (QName, Handlerregistry, Handlerinfo, ArrayList<String>) (2potential matches) java.org.apache.tomcat.util.net Aprendpoint jioendpoint nioendpoint======= explanation ========"", "" "" "" "" "Jioendpoint" "(" "" "" "" "" "" ("" "" "" "" "", "" "" "" "" ""

Legend has it that the user's request is received in Jioendpoint's accept function, which is the dividing point of tomact interaction with the outside world.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.