Original address: http://rest.elkstein.org/
Learn rest: a tutorial
The rest architecture includes the following key components:
- Resources), Identified by logical URLs, status andFunctionAll are represented by the resource.
- The logical URL means that other parts of the system can access resources.
- Resources are a key element of restful design.As the "method" and "service" in RPC and soap Web services are different, in rest, you do not need to publish "getproductname" and then call "getproductproce" rpc. You only need to regard data as a resource, which contains specific request information (or corresponding links)
- A web of resources)This means that a single resource should not be too large and requires good granularity. At any time, a resource should contain or can be linked to additional information-just like a web page
- The system hasClient-server ),Of course, one component is the server and the other component is the client.
- The connection is stateless.Interaction is stateless (although servers and resources can be stateful). Every new request should contain all the information required to complete the request, instead of relying on the previous interaction information of the same client.
- Resources should be available at any timeCachable)(There is a validity period ). The Protocol must allow the server to display whether the execution is cached resources and how long the cache takes.
-
- Because the rest protocol uses HTTP, the HTTP Cache control header can be used for this purpose.
- The client must follow the cache machine specified by the server for each resource.
- Proxy ServerIt can be used as part of the architecture to improve performance and scalability, and standard HTTP proxy can be used.
Note that your application is not based on the Rest architecture.Use the rest Service(As a client), such as a single machine, non-rest programs can access third-party rest services.