(Source: Http://www.tuicool.com/articles/Ermmmyn)
HTTP request Method:
Common methods: Get\post\head
(1) Get method. Retrieving any information from the request URL flag, accessing the Web page by entering the URL in the address bar of the browser, the browser uses the Get method to obtain resources from the server.
(2) Post method. Prepares data for request messages, which requires the requested server to accept the data appended to the request message, often used to submit the form.
(3) Head method. The class get method, which does not respond to the body portion of the page, is used to obtain basic information about the resource, which is to check the accessibility of the link and whether the resource is modified.
The request method is a program that requests a certain Web page or is used for a specific URL. You can choose from the following types:
GET: Requests the specified page information and returns the entity principal.
HEAD: Only the header of the page is requested.
POST: The requesting server accepts the specified document as a new subordinate entity for the identified URI.
PUT: Supersedes the contents of the specified document from the data that the client sends to the server.
Delete: The requested server deletes the specified page.
OPTIONS: Allow clients to view server performance.
TRACE: The request server returns the resulting content in the entity body portion of the response.
PATCH: The entity contains a table that describes the differences from the original content represented by the URI.
Move: The requesting server moves the specified page to another network address.
Copy: The request server copies the specified page to another network address.
Link: Request the server to establish a link relationship.
UNLINK: Break link relationship.
Wrapped: Allows the client to send encapsulated requests.
Extension-mothed: Additional methods can be added without altering the protocol.
When the server responds, its status line information is the version number of the HTTP, the status code, and a simple explanation of the status code. 5 Types of status codes are listed in detail now:
① Client Side Error
100 continue
101 Exchange Protocol
② success
OK
201 Created
202 Reception
203 Non-certified information
204 No Content
205 Resetting Content
206 part of the content
③ redirection
300 multi-channel selection
301 Permanent Transfer
302 Temporary transfer
303 See other
304 unmodified (not Modified)
305 using Proxies
④ Client Side Error
400 error requests (Bad request)
401 Not certified
402 Fee Required
403 Prohibition (Forbidden)
404 Not Found (not Found)
405 method does not allow
406 Not Accepted
407 Requires agent authentication
408 Request timed out
409 conflicts
410 failure
411 Required Length
412 Pieces failed
413 Request Entity too large
414 Request URI too long
415 Media type not supported
⑤ Server Error
500 Server Internal Error
501 Not implemented (not implemented)
502 Gateway Failure
504 Gateway Timeout
505 HTTP Version not supported
The contents of the entity head can also be:
Last Modified: The time when the document was requested for most recent modification.
Expires: The time when the document was requested to expire.
Connect-length: Length of document data.
Www-authenricate: Notifies the client of the required authentication information.
Connect-encoding: Indicates if there is any use of compression technology.
Transfer-encoding: Describes the type of encoding transformation used.
The standard HTTP protocol supports six kinds of request methods, namely:
0,get
1,head
2,put
3,delete
4,post
5,options
But in fact we use only get and post in most cases. These six methods are used if you want to design a Web application that is compliant with restful specifications. But even if you don't want to involve rest for the time being, understanding the nature of these six methods is still very useful. You will find that the web is also very concise and clear. The following six methods are described in turn.
0,get:get can be said to be the most common, it is essentially sending a request to get a resource on the server. Resources are returned to the client through a set of HTTP headers and rendering data (such as HTML text, or pictures or videos). In a GET request, the rendering data is never included.
The 1,head:head and get essence are the same, except that the head does not contain the rendering data, but only the HTTP header information. Some people may find this method useless, but that is not the case. Imagine a business scenario: to determine whether a resource exists, we usually use get, but the head here is more explicit.
2,put: This method is relatively rare. This is not supported by HTML forms. In essence, put and post are very similar, are sending data to the server, but there is an important difference between them, put usually specifies the location of the resources, and post is not, post data storage location by the server itself. For example, a url,/addblog for submitting a blog post. If put, the submitted URL will be "/addblog/abc123" like this, where abc123 is the address of the blog post. If you use post, the address will be communicated to the client by the server after submission. Most blogs are like this at the moment. Obviously, the put and post uses are not the same. The specific use depends on the current business scenario.
3,delete: Deletes a resource. This is mostly rare, but there are some places like Amazon's S3 cloud service that use this method to delete resources.
4,post: Submits data to the server. This method is widely used, and almost all of the current submissions are done by this.
5,options: This method is interesting, but rarely used. It is used to get the methods supported by the current URL. If the request succeeds, it contains a header named "Allow" in the HTTP header, which is the supported method, such as "GET, POST."
In fact, there is a trace method, but this basic will not be used, here is not introduced. The above six methods, we can with the database of crud additions and deletions to the operation corresponding to:
Create:put
Read:get
Update:post
Delete:delete
This allows for the perfect unification of HTTP and database operations (in fact, not just databases, any data, such as file diagrams), which is one of the essence of rest.
http://blog.csdn.net/alextiger0/article/details/5836572
http://chlotte.blog.51cto.com/318402/554758
Http://blog.sina.com.cn/s/blog_4c9ba2850100ftsy.html
Http://www.hulifeng.com/article/jishu/23.htm
Http://wenku.baidu.com/view/8f8f2025ccbff121dd36832e.html
Post,, put, etc. request methods in the HTTP protocol and some common errors