RESTful Web Services理论简介

Representational State Transfer(REST) 既不是技术也不是标准,而是一种软件架构风格,是基于Web暴露

资源的一系列指南。基于HTTP进行传输数据,使用基本的HTTP verbs.

1. 基本的REST Principles

  •      Application state and functionality are divided into resources;
  •      Resources are addressable using standard URIs that can be used as hypermedia links;
  •      All resources use only the four HTTP verbs:DELETE,GET,POST,PUT;
  •      All resources provide information using the MIME types supported by HTTP;
  •      The protocol is stateless;
  •      Responses are cacheable;
  •      The protocol is layered.

2.  REST Best Practices

  •       提供一个唯一的URI 给Expose的 Resource;
  •       URI中精良使用名词;
  •       GET verb不会改变任何数据;
  •       响应中使用Links;
  •       服务无状态;

3.  HTTP Verbs

  •      GET: 查找
  •      PUT: 更新(如果需要更新的资源不存在将进行插入操作)
  •      POST: 插入
  •      DELETE: 删除

4.  JAX-RS

      创建REST架构风格的WebService的规范。

猜你喜欢

转载自springsfeng.iteye.com/blog/1607307