The difference between GET and POST requests

xiaoxiao2021-03-06  103

About the issues you mentioned last time: // --TCP / IP protocol Detailed roll 313.3.1 Packet Type: Request and Response HTTP / 1. 0 There are two types: request and response. HTTP / 1. 0 The format of the request is: REQE T - L i n EHEADERS (0 or multiple) body (only valid for POST requests)

The format of Request - L i n e is: Request Request-URI HTTP version number

Supports the following three requests: 1) g e t request, returns any information indicated by RE Q u e S T - U R. 2) H e a d Request, similar to G E T request, but server programs only return the header of the specified document without including the actual document content. This request is usually used to test the correctness, accessibility and recent modifications of hypertext links. 3) P O S t request to send an email, news or form that can be filled in by interactive users. This is the only request to send B O D Y in the request. The length of the B O D Y is indicated in the packet header C O N T E N T - L E N g TET when using P O S t. // --TCP / IP protocol detailed 3

understand? The GET request indicates that the client requests a URI, the server returns the URI requesting the client request, and the POST request is submitted to the data when the client request is requested, and the metaphor is submitted to the FORM form, and the data to be submitted will place it in the Body section of the request message. These data are often required after the server is received after receiving such requests. When I apply for J2EE, ask this question to ask questions that the server is different from the server that is different from the processing of these two requests, not what is different from the two requests. Of course, developers as a JSP servlet generally do you feel different from two requests, because the web server has handled these requests, the web server calls the corresponding JSP / servlet to respond to the client request, For POST's request, the web server has taken the data submitted by the client and add it to the Request object. However, for GET, Post request servlet, dopost method will be called. That is to say, if the client sent is a GET request, then the code in the dopost () method in the servlet is not executed, and vice versance, if it is a request for POST, write in the doget () Code is Will not be called (for all methods, the code written in the DOSERVICE is called because the requests for Doget Dopost are distributed by DOSERVICE in the HTTPSERVLET class, and the specific look at the life cycle of the servlet) .

转载请注明原文地址:https://www.9cbs.com/read-122938.html

New Post(0)