SOA-based REST (Representational Status Transfer-declarative state Transfer) architecture style

Source: Internet
Author: User

Restful (Representational Status Transfer-declarative Status Transfer) architecture style. Currently, it mainly applies to the Internet (such as mobile clients ).

 

Hard to understand? Let's take a look at the link style:

Http://example.com/customers/1234 

In this case, REST is a set of rules defining Web standards, such as HTTP and URIs.

 

REST key rules

1. Given any "resource" ID

2. Connect all resources

3. Use standard methods (Get, Post, Delete, Put)

4. Multiple Expressions of "Resources"

5. Stateless Communication

 

1. Given any "resource" ID

A resource is a term and is generally used as a set of key abstract features.

Here, we use URI (Unified Resource Identifier-Unified Resource Identifier) as the ID to identify resources. (URI consists of a global namespace -- http://example.com, and a global ID that can identify resources -- MERs/1234)

Therefore, we can use URI to identify a real resource (including ID ). Whether this resource is an expressive single resource (such as an object), a resource set, a virtual or physical object, or a computing result.


2. Connect all resources

Internet, you can use links to reference resources that actually exist. Hyperlinks can make the Internet more social and networked.


3. Use standard methods (Get, Post, Delete, Put)

Rest http Method application scenarios:

Class Resource {<br/> Resource (URI u); <br/> Response get (); <br/> Response post (Request r ); <br/> Response put (Request r); <br/> Response delete (); <br/>} 

Example:

For example, to obtain a list of all customers for the customers resource, use Get; Add a new user and use Post; others are not used for the moment. The Get and Post operations on the resources customers are a kind of state transfer.


4. Multiple Expressions of "Resources"

Presentation of resource representations, which can be XML, TXT (plain text), and JSON format information. Therefore, you can provide different resource expressions as needed.


5. Stateless Communication

This stateless State may be a bit misleading. It refers to the stateless state of thinking. It does not mean that an object or a function is stateless, but that this stateless state is manifested in the resource state. Therefore, stateless communication isolates the dependency between the client and the server.

 

Make good use of these rules to beautify your Web style. The article is rough. Please advise!

Link: http://www.infoq.com/articles/rest-introduction

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.