Rest之路 - Rest架构中的重要概念
资源
在Rest的架构之内,讲一切内容都是为资源。每一个资源都被定义为一个URI。
格式: <protocol>://<service-name>/<ResourceType>/<ResourceID>
除此之外,URI的另一个关键部分为“VERB“, 相应的我们也称他们为“方法”。他们通常有四种形式 -- GET/POST/PUT/UPDATE
关于资源的表述,Rest有多种形式的表述方式,其中以XML和JSON最为常用。
消息
Rest 采用HTTP协议作为client和server之间的传输媒介。 client 通过发送 HTTP Request 到 Server;Server 发送 HTTP Response 到 client。
为了方便理解,通过图文并茂的方式来解释一下 HTTP Request/Response.
以下部分摘自: https://www.tutorialspoint.com/restful/restful_messages.htm
HTTP Request

A HTTP Request has five major parts:
Verb- Indicate HTTP methods such as GET, POST, DELETE, PUT etc.
URI- Uniform Resource Identifier (URI) to identify the resource on server
HTTP Version- Indicate HTTP version, for example HTTP v1.1 .
Request Header- Contains metadata for the HTTP Request message as key-value pairs. For example, client ( or browser) type, format supported by client, format of message body, cache settings etc.
Request Body- Message content or Resource representation.
HTTP Response

A HTTP Response has four major parts:
Status/Response Code- Indicate Server status for the requested resource. For example 404 means resource not found and 200 means response is ok.
HTTP Version- Indicate HTTP version, for example HTTP v1.1 .
Response Header- Contains metadata for the HTTP Response message as key-value pairs. For example, content length, content type, response date, server type etc.
Response Body- Response message content or Resource representation.
Example
As we have explained in RESTful Web Services - First Application tutorial, Let's put http://localhost:8080/UserManagement/rest/UserService/users in POSTMAN with GET request. If you click on Preview button residing near send button of Postman and then click on Send button, you may see the following output.

Here you can see, the browser sent a GET request and received a response body as XML.
Rest之路 - Rest架构中的重要概念的更多相关文章
- Rest之路 - Rest架构中的重要概念(二)
状态无关性 Rest 架构中不维持client,resource and request 的状态,我们通常称 Rest 服务是状态无关的.基于此的优势是为设计Rest架构提供了简便:每一个请求可以被完 ...
- 分享一个CQRS/ES架构中基于写文件的EventStore的设计思路
最近打算用C#实现一个基于文件的EventStore. 什么是EventStore 关于什么是EventStore,如果还不清楚的朋友可以去了解下CQRS/Event Sourcing这种架构,我博客 ...
- [译]Google官方关于Android架构中MVP模式的示例
概述 该示例(TODO-MVP)是后续各种示例演变的基础,它主要演示了在不带架构性框架的情况下实现M-V-P模式.其采用手动依赖注入的方式来提供本地数据源和远程数据源仓库.异步任务通过回调处理. 注意 ...
- 大型 JavaScript 应用架构中的模式
原文:Patterns For Large-Scale JavaScript Application Architecture by @Addy Osmani 今天我们要讨论大型 JavaScript ...
- [转]大型 JavaScript 应用架构中的模式
目录 1.我是谁,以及我为什么写这个主题 2.可以用140个字概述这篇文章吗? 3.究竟什么是“大型”JavaScript应用程序? 4.让我们回顾一下当前的架构 5.想得长远一些 6.头脑风暴 7. ...
- 三层架构中bll层把datatable转换为实体model的理解
看了很多人的项目,很多都是用到三层架构,其中BLL层中有一种将DataTable转换为实体的方法.一直没有明白为啥要这样做,今天特意去搜索了一下,如果没有答案我是准备提问,寻求解答了.还好找到一个相关 ...
- 谈谈三层架构中Model的作用
Model又叫实体类,这个东西,大家可能觉得不好分层.包括我以前在内,是这样理解的:UI<-->Model<-->BLL<-->Model<-->DAL ...
- linux驱动程序之电源管理之新版linux系统设备架构中关于电源管理方式的变更
新版linux系统设备架构中关于电源管理方式的变更 based on linux-2.6.32 一.设备模型各数据结构中电源管理的部分 linux的设备模型通过诸多结构体来联合描述,如struct d ...
- 微服务架构中API网关的角色
[上海尚学堂的话]:本文主要讲述了Mashape的首席技术执行官Palladino对API网关的详细介绍,以及API网关在微服务中所起的作用,同时介绍了Mashape的一款开源API网关Kong. A ...
随机推荐
- html5适应屏幕的方案
适应屏幕的方案: 1.css3 Media queries (针对多版本设计稿) 2.设计稿不复杂的时候 通过宽度自适应用百分比 3.通过更新meta:viewport标签,通过设计稿尺寸 ...
- yii2定时任务不执行,报错PHP date调用警告:It is not safe to rely on the system's timezone settings
It is not safe to rely on the system's timezone settings 在写php程序中有时会出现这样的警告:PHP Warning: date(): It ...
- Django进阶Model篇007 - 聚集查询和分组查询
接着前面的例子,举例聚集查询和分组查询例子如下: 1.查询人民邮电出版社出了多少本书 >>> Book.objects.filter(publisher__name='人民邮电出版社 ...
- 51nod 1383 母函数
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1383 一眼望去,不就是硬币兑换吗,母函数或者dp,直接暴力dp就A了,不 ...
- HBase Cassandra比较
转自:http://itindex.net/detail/22338-cassandra-hbase-%E8%AE%BE%E8%AE%A1 Cassandra HBase 一致性 Quorum ...
- Cassandra 数据模型设计,根据你的查询来制定设计——反范式设计本质:空间换时间
转自:http://www.infoq.com/cn/articles/best-practice-of-cassandra-data-model-design 不要把Cassandra model想 ...
- Win7系统搭建WiFi热点详细攻略
(转自:http://blog.csdn.net/gisredevelopment/article/details/16113889) 一.如果你之前没有在笔记本上搭建过WiFi,那么恭喜你,你的笔记 ...
- charles抓包并分析问题
1.抓包并分析 某列表页 传入的参数: -------------------------------------------------------------------------------- ...
- 旧书重温:0day2【10】第五章 堆溢出利用2
好久没有发帖子啦!最近一直很忙!但是还是抽空学习啦下! 前段时间匆匆忙忙的把0day2上的堆溢出实验做啦! 可能当时太浮躁啦,很多细节没注意!结果:实验结果很不满意!所以就有啦这一篇!! 上一篇是发布 ...
- LUAROCKS 报错解决办法
用luarocks 加载包时报错 Warning: falling back to curl - install luasec to get native HTTPS support 此时先安装 ./ ...