Tomcat: Chapter 1: The relationship between Web applications and HTTP requests and Cookies and Session

Web development history:

  • Early web applications were mainly used to browse static pages such as news. HTTP servers (such as Apache, Nginx) returned static HTML to the browser, and the browser was responsible for parsing the HTML and presenting the results to the user.
  • Through some interactive operations, to obtain dynamic results, so some extension mechanisms are needed to allow HTTP servers to call server-side programs. Sun has introduced Servlet technology.
  • Servlet is a Java applet running on the server, but Servlet has no main method and cannot run independently. Therefore, it must be deployed to the Servlet container, which is instantiated and called by the Servlet.
  • Tomcat is a servlet container. For convenience, they also have the function of HTTP server, so Tomcat is a "HTTP server + Servlet container", we also call them Web container.

The browser needs to obtain an HTML text from the remote HTTP server

  • Establish a Socket connection with the server.
  • Generate request data and send it out through Socket.

The HTTP request data consists of three parts, namely the request line, request header, and request body.

Guess you like

Origin blog.csdn.net/java_wxid/article/details/108661218