Network request http get post 1

Source: Internet
Author: User

HTTP defines different ways to interact with the server. There are four basic methods: Get post put Delete, full URL resource descriptor. We can think of a URL address, a URL address, it is used to describe resources on a network, while get post put delete in HTTP corresponds

1According to the HTTP specification, get is used for information retrieval, and should be secure and idempotent.

(1). The so-called security means that the operation is used to obtain information rather than modify information. In other words, get requests generally do not have side effects. That is to say, it only obtains the resource information, just like the database query. It does not modify, add data, and does not affect the resource status.

* Note: security only indicates that the information is not modified.

(2) idempotence means that multiple requests to the same URL should return the same result. Here I will explain it again.IdempotenceThis concept:

Idempotence(Idempotent, idempotence) is a mathematical or computer concept, common in abstract algebra.
Idempotence can be defined as follows:
For a single-object operation, if an operation is performed multiple times for all the numbers in the range, the result is the same as that obtained once, this operation is called idempotent. For example, an absolute value operation is an example. In a real number set, ABS (A) = ABS (a) is used )).
For binary operations, it is required that when the two values involved in the calculation are equivalent, if the calculation result is equal to the two values involved in the calculation, the operation is called the idempotence, for example, a function that calculates the maximum values of two numbers has the power in the real number set, that is, Max (x, x) = x.


  2According to the HTTP specification, post indicates a request that may modify the resources on the server. Continue to reference the above example: for news websites, readers should post their comments on news, because the Site Resources are different after the comments are submitted, or the resource is modified.



The above describes some of the principles of get and post in the HTTP specification. However, in practice, many people fail to follow the HTTP specification, which leads to many reasons, such:

  1. A lot of people are greedy and convenient. Get is used to update resources, because form must be used for post, which will be a little troublesome.

  2. You can add, delete, modify, and query resources through get/post without using put or delete.

  3. In addition, early web MVC Framework designers did not consciously treat and design URLs as abstract resources, therefore, a serious problem is that the traditional Web MVC framework basically only supports the get and post HTTP methods, rather than the put and delete methods.

* MVC: MVC originally exists in the desktop program, M is the exponential data model, V is the user interface, and C is the controller. The purpose of using MVC is to separate the implementation code of M and V, so that the same program can use different expressions.




Network request http get post 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.