知识卡片
按超媒体控制发请求
服务会随权限和资源状态改变可用动作,客户端不能永久固化这些调用细节。
超媒体控制把下一步请求的地址、方法、编码与参数交给响应描述;客户端识别动作语义后使用这些实时细节。例如REQUEST WITH-FORM taskFormEdit WITH-STACK把已修改数据填入当前响应的编辑表单。
H-Factor可检查格式能表达多少调用信息:LE嵌入、LO外跳、LT模板、LN非幂等、LI幂等链接,以及CR读、CU写、CM方法、CL关系控制。支持不足的部分仍需本地知识;普通JSON本身没有这些控制,不能仅因返回JSON就声称解耦。
关联:[[响应元素的四类标识]]、[[用词汇契约识别动作]]。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 超媒体客户端 · 查看原书依据
The advantage of relying on supplied hypermedia in your scripts is that you reduce the amount of hardcoding you need to do within your client application. You can make it easier for services to modify hypermedia details (e.g., URLs, HTTP methods, supported formats, etc.) without breaking the client application. In the preceding example, the script does not hardcode the HTTP URL, method, or encoding type for the taskFormEdit action. It simply uses the details supplied by the service.