- 浏览: 81814 次
- 性别:
- 来自: 信阳
文章分类
- 全部博客 (47)
- 数据库 (2)
- web应用 (14)
- 杂 (3)
- java基础 (3)
- Lucene (6)
- junit (2)
- spring (0)
- solr (4)
- JMS (0)
- 持久层 (0)
- 模板解决方案 (4)
- 项目发布管理 (0)
- GIS (0)
- 运维知识 (1)
- 设计模式 (2)
- 线程 (2)
- java.util (0)
- Linux (0)
- JVM (0)
- HTML5 (1)
- 敏捷开发 (0)
- 压力测试 (1)
- 字节码操控框架 (0)
- Classworking (1)
- EJB (1)
- REST (7)
- Restlets (4)
- Groovy (1)
- Selenium (1)
- test (3)
- Jersey一 (0)
- 架构分析 (0)
- 研发管理 (1)
- JAAS (0)
- JSCoverage (1)
- EclEmma (1)
- 计划 (0)
- jQuery (0)
- javascript MVC (0)
最新评论
-
悬空90:
兄弟人才啊 。英文不好找了老半天
web容器一、jetty的学习(下载源码) -
liushicheng1:
我也找了半天 被你发现了 人才。
web容器一、jetty的学习(下载源码) -
gandilong:
不过,我想通过ant+freemarker+xml生成jav ...
java代码自动生成一(freemarker) -
xinyangwjb:
solr官网例子默认编码是UTF-8,你的项目是不是UTF-8 ...
solr学习三(测试类,含普通与ExtractingRequestHandler测试) -
wjx:
up.setParam设置的内容如果有中文的话会乱码,不知lz ...
solr学习三(测试类,含普通与ExtractingRequestHandler测试)
Imagine an online application that manages races in which contestants run various distances(such as the Chicago Marathon).The application manages races(or events)and the runners associated with them.And it reports a particular runner's time (how long it took to run the race) and rank(what place the runner finished in).The race-management company,Acme Racing,wants you to build a RESTful Web service that enables sponsors to create new races and racers for a particular race,and that can provide official results for a particular race.
想象一个管理很多选手跑很多种距离的比赛的在线应用,这个应用管理比赛和参赛的选手。他报道制定选手的时间和名次。Acme Racing公司希望创建一个RESTful的Web服务,能够支持为指定的比赛创建新比赛和选手,并且提供官方结果。
Acme Racing already has a legacy fat-client application that supports similar requirements and leverages a simple database along with a domain model.Thus,the job of exposing this functionality is all that's left to do.Remember that the beauty of REST it its implicit loose coupling with an underlying application. accordingly,your job,at the moment,isn't to worry about the data model or the technology associated with it-it's to construct a RESTful API that supports the company's requirements.
Acme Racing 公司有个遗留的富客户端应用支持类似需求,并利用一个简单的基于数据库的对象模型。我们的工作就是暴露这些功能。记住REST的优美之处在于隐含的低耦合的底层应用。
__________________________________________________________________________________
Race URIs(uniform resource identifies)统一资源标示
Acme Races would like sponsors to be able to:
*View the details of existing races
*Create new races
*Update existing races
*Delete races
Beacuse REST boils down to named resources,the API becomes a series of URI patterns,and the behavior associated with a resource is invoked via standard HTTP commands.
因为REST可归结于命名资源,API成为一系列的URI模式。并且通过标准的HTTP命令使行为联系资源被调用。
As you can see,the client's requirements map nicely to CRUD. And as you konw from Table1,REST supports CRUD via the HTTP POST,GET,PUT,and DELETE requests,respectively,Accordingly,a base RESTful URI that supports these requirements could be http://racing.acme.com/race.Note that in this case,race is the resource clients would work with.
用户的需求很好的映射为CRUD。REST通过HTTP POST,GET,PUT,and DELETE来支持CRUD。因此,一个基础的支持这些需求的RESTful URI是http://racing.acme.com/race。注意这种情况下,race是资源客户将操作的。
Invoking this URI with an HTTP GET would return a list of races.(Don't worry about the format of the response just yet.)To add a new race,you would invoke the same URI with an HTTP POST containing the appropriate information(for instance,an XML document containing required race information,such as name,date,and distance).
调用这个URI进行HTTP GET请求会返回一列races。(这时先别考虑如何格式化response)添加一个新的race,你要提交相同的URI,只需URI使用POST提交,并且包含一些适当的信息(这个实例,一个XML文件包含race需求的信息,如名称,时间和距离)。
For updating and deleting existing races,you would need to act on a particular instance of a race.Accordingly,individual races can be addressed with a URI of http://racing.acme.com/race/race_id.In this case ,race_id represents a placeholder for any race identifier(such as 1 or 600 meter).Consequently,viewing an existing race instance would be an HTTP GET to that URI:updating or deleting a race would be a PUT or DELETE request,respectively.
修改和删除已经存在的races,你将需要按照具体的实例来处理race。因此,不同个体的races可以被URI定位为http://racing.acme.com/race/race_id。这种情况下,race_id代表了一个任何race标示的占位符。因此,查看的URI是GET,删除时DELETE,修改时PUT.
Acme would also like the service to let users view individual data for a particular runner in a particular race.They'd like their service to support:
*Obtaining all runners for a particular race. This data should also include run times and ranks for a race that's already completed.
*Creating one or more runners for a particular race.
*Updating a runner's information(such as age)for a particular race.
*Deleting a runner for aparticular race.
公司要求为用户提供这样的服务:查看指定race的指定runner。包括获得指定race所有runners的信息。为race创建runner,为race修改runner及删除信息。
Acme would also like the service to let users view individual data for a particular runner in a particular race.
公司要求为用户提供查看指定race指定runner的个人资料的服务。
Just as with races,applying RESTful URIs to runners associated with a race is a logical exercise.Viewing all runners for a particular race,for example,would be implemented via a GET request to http://racing.acme.com/race/race_id/runner.
RESTful URIs同样适用于关联race的runner。
Obtaining individual data for a runner in a race would be addressed as http://racing.acme.com/race/race_id/runner/runner_id.
得到race的runner的个人数据可以定位为..
Just like race_id,runner_id is a placeholder for the logical implementation of IDs,which could be numbers,names,alphanumeric combinations,and so on.
正如race_id,runner_is是逻辑实现的占位符,他们可以使数字,名称,字母数字组合等等。
Adding runners to a race would be a POST request to http://racing.acme.com/race/race_id/runner. Updating or deleting particular runners would be, respectively, PUT and DELETE requests to http://racing.acme.com/race/race_id/runner/runner_id.
Thus, these URIs (each supporting some or all of the four standard HTTP requests) capture Acme Racing's requirements:
/race
/race/race_id
/race/race_id/runner
/race/race_id/runner/runner_id
Remember, a particular URI can map to more than one HTTP verb (for instance, applying an HTTP GET to /race returns data; applying a POST with appropriate data creates data on the server). Accordingly, some HTTP commands wouldn't be implemented. For example, /race wouldn't support the DELETE command (Acme Racing wouldn't want to delete all races); /race/race_id could support the DELETE command because removing a particular instance of a race is a business requirement.
想象一个管理很多选手跑很多种距离的比赛的在线应用,这个应用管理比赛和参赛的选手。他报道制定选手的时间和名次。Acme Racing公司希望创建一个RESTful的Web服务,能够支持为指定的比赛创建新比赛和选手,并且提供官方结果。
Acme Racing already has a legacy fat-client application that supports similar requirements and leverages a simple database along with a domain model.Thus,the job of exposing this functionality is all that's left to do.Remember that the beauty of REST it its implicit loose coupling with an underlying application. accordingly,your job,at the moment,isn't to worry about the data model or the technology associated with it-it's to construct a RESTful API that supports the company's requirements.
Acme Racing 公司有个遗留的富客户端应用支持类似需求,并利用一个简单的基于数据库的对象模型。我们的工作就是暴露这些功能。记住REST的优美之处在于隐含的低耦合的底层应用。
__________________________________________________________________________________
Race URIs(uniform resource identifies)统一资源标示
Acme Races would like sponsors to be able to:
*View the details of existing races
*Create new races
*Update existing races
*Delete races
Beacuse REST boils down to named resources,the API becomes a series of URI patterns,and the behavior associated with a resource is invoked via standard HTTP commands.
因为REST可归结于命名资源,API成为一系列的URI模式。并且通过标准的HTTP命令使行为联系资源被调用。
As you can see,the client's requirements map nicely to CRUD. And as you konw from Table1,REST supports CRUD via the HTTP POST,GET,PUT,and DELETE requests,respectively,Accordingly,a base RESTful URI that supports these requirements could be http://racing.acme.com/race.Note that in this case,race is the resource clients would work with.
用户的需求很好的映射为CRUD。REST通过HTTP POST,GET,PUT,and DELETE来支持CRUD。因此,一个基础的支持这些需求的RESTful URI是http://racing.acme.com/race。注意这种情况下,race是资源客户将操作的。
Invoking this URI with an HTTP GET would return a list of races.(Don't worry about the format of the response just yet.)To add a new race,you would invoke the same URI with an HTTP POST containing the appropriate information(for instance,an XML document containing required race information,such as name,date,and distance).
调用这个URI进行HTTP GET请求会返回一列races。(这时先别考虑如何格式化response)添加一个新的race,你要提交相同的URI,只需URI使用POST提交,并且包含一些适当的信息(这个实例,一个XML文件包含race需求的信息,如名称,时间和距离)。
For updating and deleting existing races,you would need to act on a particular instance of a race.Accordingly,individual races can be addressed with a URI of http://racing.acme.com/race/race_id.In this case ,race_id represents a placeholder for any race identifier(such as 1 or 600 meter).Consequently,viewing an existing race instance would be an HTTP GET to that URI:updating or deleting a race would be a PUT or DELETE request,respectively.
修改和删除已经存在的races,你将需要按照具体的实例来处理race。因此,不同个体的races可以被URI定位为http://racing.acme.com/race/race_id。这种情况下,race_id代表了一个任何race标示的占位符。因此,查看的URI是GET,删除时DELETE,修改时PUT.
Acme would also like the service to let users view individual data for a particular runner in a particular race.They'd like their service to support:
*Obtaining all runners for a particular race. This data should also include run times and ranks for a race that's already completed.
*Creating one or more runners for a particular race.
*Updating a runner's information(such as age)for a particular race.
*Deleting a runner for aparticular race.
公司要求为用户提供这样的服务:查看指定race的指定runner。包括获得指定race所有runners的信息。为race创建runner,为race修改runner及删除信息。
Acme would also like the service to let users view individual data for a particular runner in a particular race.
公司要求为用户提供查看指定race指定runner的个人资料的服务。
Just as with races,applying RESTful URIs to runners associated with a race is a logical exercise.Viewing all runners for a particular race,for example,would be implemented via a GET request to http://racing.acme.com/race/race_id/runner.
RESTful URIs同样适用于关联race的runner。
Obtaining individual data for a runner in a race would be addressed as http://racing.acme.com/race/race_id/runner/runner_id.
得到race的runner的个人数据可以定位为..
Just like race_id,runner_id is a placeholder for the logical implementation of IDs,which could be numbers,names,alphanumeric combinations,and so on.
正如race_id,runner_is是逻辑实现的占位符,他们可以使数字,名称,字母数字组合等等。
Adding runners to a race would be a POST request to http://racing.acme.com/race/race_id/runner. Updating or deleting particular runners would be, respectively, PUT and DELETE requests to http://racing.acme.com/race/race_id/runner/runner_id.
Thus, these URIs (each supporting some or all of the four standard HTTP requests) capture Acme Racing's requirements:
/race
/race/race_id
/race/race_id/runner
/race/race_id/runner/runner_id
Remember, a particular URI can map to more than one HTTP verb (for instance, applying an HTTP GET to /race returns data; applying a POST with appropriate data creates data on the server). Accordingly, some HTTP commands wouldn't be implemented. For example, /race wouldn't support the DELETE command (Acme Racing wouldn't want to delete all races); /race/race_id could support the DELETE command because removing a particular instance of a race is a business requirement.
发表评论
-
javascript异步事件分析
2013-05-22 14:25 0console.log( "a" ); ... -
javascript作用域链的灵活运用1
2013-05-21 19:58 821javascript比较出彩的运用之一:作用域链。 1、对于有 ... -
2012-2013总结之javascript
2013-05-02 14:54 0javascript能力的来源与基石是一本书:javascri ... -
Js闭包理解、运用
2012-11-08 14:12 901onClick: (function (){ ... -
URL转义及编码
2012-08-31 11:01 824js对文字进行编码涉及3个函数:escape,encodeUR ... -
JS的架构
2012-06-25 09:35 0js代码页也需要架构,他能使你的代码更加漂亮,益于维护,便于代 ... -
各种浏览器语言包、国际化如何配置
2012-04-18 15:36 2968如果web项目使用了国际化多语言包,切换浏览器语言包可以切换 ... -
RESTful初探之六(testing)
2012-04-12 17:04 994Building and testing the servic ... -
RESTful初探之五(The data layer)
2012-04-12 14:34 952原文:http://www.ibm.com/developer ... -
RESTful初探之五(Generating XML documents)
2012-04-12 13:57 912In the Formatting the resource, ... -
RESTful初探之四(Restlets)
2012-04-11 18:14 1285Restlets Restlet项目为“建立REST概念与Ja ... -
RESTful初探之三(Formating the resource)
2012-04-11 16:52 872Race URIs The RESTful API you b ... -
RESTful初探之一(What is REST)
2012-04-11 11:32 967英文tutorial guide http://www.ibm ... -
关于java Web Project引包的问题
2012-02-14 17:03 1573这里要说的是Web Project如何合理引入jar包的问题。 ... -
web容器二、jetty的学习(主要接口)
2012-01-15 22:49 1068学习资料: 官方Wiki:http://docs.codeh ... -
web容器一、jetty的学习(下载源码)
2012-01-15 00:26 2405由于jetty是由java编写的web容器,因此,对web容器 ... -
servlet容器监听器与拦截器
2012-01-11 18:05 0二者都是在web.xml中加载,分别为: <listen ... -
http传参get与post的误区与总结
2012-01-11 10:18 2917众所周知的http请求有两种: get与post: 这两种请求 ... -
如何在struts2拦截器中获得request
2011-12-22 15:23 2022由struts2原理图可知道,interceptor发生在ac ...
相关推荐
Python Flask高级编程之RESTFul API前后端分离精讲第六章节Python Flask高级编程之RESTFul API前后端分离精讲第六章节Python Flask高级编程之RESTFul API前后端分离精讲第六章节Python Flask高级编程之RESTFul API...
本书《*** MVC 4 and the Web API: Building a REST Service from Start to Finish》专注于如何利用*** MVC 4框架结合Web API构建世界级的REST服务。该书深入详细地介绍了如何使用*** MVC 4和Web API构建先进的REST...
thinkphp6 RESTful API开发 开发过程记录笔记 https://blog.csdn.net/weixin_41120504/article/details/115638094
Python Flask高级编程之RESTFul API前后端分离精讲第二章节Python Flask高级编程之RESTFul API前后端分离精讲第二章节Python Flask高级编程之RESTFul API前后端分离精讲第二章节Python Flask高级编程之RESTFul API...
SpringBoot+Mybatis+CXF框架,实现Restful api与 WebService api接口的大实验 本实验的主要目标是使用SpringBoot、Mybatis和CXF框架来实现Restful API和WebService API接口的大实验。下面是实验的详细介绍: 标题...
restful api访问k8s集群,增删改查信息。 需要预先创建访问权限的配置。 官网api文档 https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/ 下面罗列部分api curl -u admin:admin ...
Python Flask高级编程之RESTFul API前后端分离精讲Python Flask高级编程之RESTFul API前后端分离精讲Python Flask高级编程之RESTFul API前后端分离精讲Python Flask高级编程之RESTFul API前后端分离精讲Python Flask...
### RESTful API设计规范详解 #### 一、RESTful简介 RESTful是一种广泛应用于Web服务的设计风格,全称为...此外,RESTful设计还支持缓存机制、统一接口等特性,这些都使得RESTful API成为构建现代Web服务的标准之一。
#### 二、RESTful API 动词与方法 RESTful API 中最基础的概念之一是HTTP动词,它们代表了客户端向服务器发起请求的不同类型。常见的HTTP动词及其含义如下: 1. **GET**: - **用途**:用于获取资源的信息。 - *...
RESTfulAPI设计:RESTfulAPI设计基础.docx
and profile RESTful APIs with each of the frameworks Develop a complex RESTful API that interacts with a PostgreSQL database Add authentication and permissions to a RESTful API built in each of the ...
**二、RESTful API概念** REST(Representational State Transfer)是一种网络应用程序的设计风格和开发方式,基于HTTP协议,以资源为中心,通过URI(Uniform Resource Identifier)来标识资源,使用标准的HTTP方法...
RESTfulAPI设计:RESTfulAPI安全性设计.docx
本篇文章将详细探讨.NET作为客户端调用WebAPI RESTful服务端的方法,以及如何开发RESTFUL服务端以供客户端调用。 首先,让我们了解一下客户端如何使用.NET调用WebAPI RESTful服务端。这通常涉及以下几个步骤: 1. ...
本项目提供了一个RestfulApi服务端的示例,帮助开发者了解如何构建这样的服务。 在RestfulApi服务端的实现中,通常会用到以下技术栈: 1. **服务器框架**:如Spring Boot或Express.js,它们为快速构建RESTful API...
**RestFul API 知识点详解** REST(Representational State Transfer)是一种网络应用程序的设计风格和开发方式,基于HTTP协议,以数据为中心,强调资源的状态转移。RESTful API是遵循REST原则设计的Web服务接口,...
本文将深入探讨如何使用C和C++来实现HTTP服务,并开发RESTful API服务器。 首先,HTTP(超文本传输协议)是互联网上应用最为广泛的一种网络协议,用于从万维网服务器传输超文本到本地浏览器。它是一个基于请求与...
#### 二、RESTful API 的关键要求 设计 RESTful API 时,应遵循以下关键要求: 1. **遵循 Web 标准**:在适当的地方使用 Web 标准,如 HTTP 协议、状态码等,这有助于提高 API 的互操作性和可维护性。 2. **开发者...
Spring Boot 整合 Mybatis 实现RESTful API ,具体可以查看博客: http://blog.csdn.net/yaozhiqi1905658804/article/details/70820892