代表性国家转移(REST)中的“国家转移”是指什么? [英] What does “state transfer” in Representational State Transfer (REST) refer to?

查看:123
本文介绍了代表性国家转移(REST)中的“国家转移”是指什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Representational State Transfer中的州转移是指什么?

What does the State Transfer in Representational State Transfer refer to?

找到一些关于此的解释(例如这里)但我仍然不明白。例如,在文章中,它被称为

Found some explanations about this (e.g. here) but I still don't understand. For example in the article it is said


该表示将客户端应用程序置于一个状态。

The representation places the client application in a state.

为什么?状态(据我理解,类似于会话)与资源的表示有什么关系?

Why? What does state (as I understand it, something like a session) have to do with a representation of a resource?

推荐答案


为什么?状态(据我理解,类似会话)与资源的表示有什么关系?

Why? What does state (as I understand it, something like a session) have to do with a representation of a resource?

一个对象有属性(或状态)和行为(或方法)。

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

如果我想将对象从桌面移动到服务器,我必须执行以下操作:

If I want to move an object from my desktop to a server I have to do the following:


  1. 创建对象状态的表示。

  1. Create a representation of the state of the object.

将该表示从桌面转移到服务器。

Transfer that representation from the desktop to the server.

我不转移的方法。我在两台机器上安装了相同的类定义。

The methods I don't transfer. I install the same class definition on both machines.

因此,REST是关于创建对象当前状态的表示,以便它可以转移到另一个服务器的对象可以重建。

So, REST is about creating a representation of the object's current state so it can be transferred to another server from which the object can be reconstructed.

我们只发送对象的状态 - 属性。我们必须创建该状态的外部序列化表示。

We only send the state -- the attributes -- of the object. And we have to create an external, serialized representation of that state.

这篇关于代表性国家转移(REST)中的“国家转移”是指什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆