What does “state transfer" mean in a representative state transfer (REST)?

What does State Transfer in the State State Transfer view transmit?

Found a few explanations about this (for example, here ), but I still do not understand. For example, the article says

The view puts the client application in state.

Why? What state (as I understand it, something like a session) is associated with the presentation of the resource?

+15
rest terminology
Jan 05 2018-11-11T00:
source share
3 answers

Why? What state (as I understand it, something like a session) is associated with the presentation of the resource?

An object has attributes (or state) and behavior (or methods).

If I want to move an object from my desktop to the server, I must do the following:

  • Create a state view of the object.

  • Transfer this view from the desktop to the server.

Methods that I do not pass. I set the same class definition on both machines.

So, REST is the creation of a representation of the current state of an object so that it can be transferred to another server from which the object can be restored.

We send only the state - the attributes of the object. And we must create an external serialized representation of this state.

+15
Jan 05 2018-11-11T00:
source share

Consider the client application as a kind of giant state machine. The initial state of the client is equal to the first view returned from the server. Links in the returned view provide possible "state transitions".

You might think that there are two main types of links: passive and active. Passive links, such as <img> and <link rel="stylesheet"> , do not actually cause a state transition, they simply increase the current state. Links such as <form> and <a> , however, are active links and cause a state transition. After executing one of these links, the new client state is equal to the returned view, aka state transfer .

If you are used to creating traditional client-side applications for desktop computers, you will find that this is a fundamentally different architecture. Not the one you are likely to forget at night. Initially, this approach may seem very limited, but if you think that the client application can be the host for many simultaneously running state machines, you will begin to understand that you can do anything, that you could use the remote architecture of the object and still maintain free web browser connection.

+10
Jan 06 2018-11-11T00:
source share

A network consists of resources. A resource is any item of interest. For example, TheBoeing Aircraft Corp can define a resource 747. Customers can access this resource using thisURL: http://www.boeing.com/aircraft/747A the resource is returned (for example, Boeing747.html). The view puts the client application in state. The result of the client accessing the inBoeing747.html hyperlink is access to another resource. The new view puts the client application in a different state. Thus, the client application changes (transfers) the state with each representation of resources → Representative state transfer!

+1
Dec 17 '14 at 0:16
source share



All Articles