Servlet call process, servlet call
(1) enter the address in the browser. The browser first searches for the hosts file and translates the host name into an IP address. If the host name cannot be found, the browser then queries the dns server and translates the host name into an IP address.
(2) the browser accesses the server based on the IP address and port number, and organizes http request information to be sent to the server.
(3) After receiving the request, the server first checks the virtual Host currently accessed Based on the Host request header.
(4) The server determines which web application is currently accessed based on the request URI in the http request header.
(5) The server determines which web application is currently accessed based on the request URI in the http request header.
(6) Check the web. xml file of the web application. If you find all the paths of the specific servlet processing Class Based on the path, submit the paths to the servlet for processing. If not, submit them to the default servlet for processing.
(7) In this process, the browser only knows that it has sent an http request and soon received an http response. The browser does not know or care about how the server processes the request. The relationship between the browser and the server is very simple, only HTTP protocol.
(8) parsing requests, encapsulating RequestResponse objects, creating Servlets, and calling Servlet methods are all automatically performed by the server. Developers only need to write the Servlet and call the Service method automatically by the server, we only need to write the Servlet configuration into the container.