HTTP is a set of rules for computers to communicate in a network
The HTTP request contains the request line, the request header, the blank line, and the message body
The HTTP response contains a status line, a response header, a blank line, and a message body
Web server has a flaw
CGI programs consume server resources severely, and servlets can eliminate this flaw
The Web container provides an environment for application components that are in the container
A Web application includes configuration files, static files, JSPs, class files, and packages
Tomcat is both an excellent jsp/servlet container and an HTTP server
Server.xml and Web. Xml are the main configuration files for Tomcat
Welcome-file-list indicates which file the server uses when it receives a directory name instead of the URL of the file name
The client initiates an HTTP request to the Web server.
HTTP requests are accepted by the Web server and are handled by the Web server if a static page is requested. If a Java Web Component (servlet or JSP) is requested, it is handed over to the Web container. The Web container can be started in the process of the same process, different processes, or other Web service hosts of the host.
The Web container determines the specific servlet class to invoke, based on the configuration file of the servlet, and passes the request object, the response object, to it.
The servlet knows who the client is using through the request object, what the customer's request information is, and some other information. When the servlet finishes processing the request, it puts the information to be returned into the response object and returns it to the client.
Once the servlet has finished processing the request, the Web container refreshes the response and returns control to the Web server.
How Java Web Works