Servlet -- HTTP, servlethttp
I. HTTP protocol
· HTTP-Hypertext Transfer Protocol
· HTTP messages include the request message sent from the client to the server and the corresponding message sent from the server to the client.
· Information Exchange Process between browsers and servers
· Establish a connection
· Send request information
· Return response information
· Close connection
· HTTP is a stateless protocol.
· HTTP1. 1 supports persistent connections. A single connection can send multiple requests.
· The so-called stateless State means that the request response has no relationship with the next request response
· Basic HTTP request format
1) Request Line
2) Request Header
3) Request Entity (there will be request entities when the post method is submitted, and the get method is submitted without the Request Entity)
4) The get method transmits parameters through the request line. The amount of information that can be transferred is small and insecure.
5) The post object transfers parameters with a large amount of information, which is safe.
· Basic HTTP Response format
1) Status line
2) one or more Response Headers
3) a blank line
4) response entity
5) Connection: Specifies whether to maintain the Connection after processing the response of this request.
6) Date: the time when the current message was generated.
7) Pragma and Cache-Control: whether to Cache
8) Content-Length: Length of the Request/response body