Spring Boot 2.0深度实践之核心技术篇【第六章 Web MVC REST应用 】

6-1 Web MVC REST应用和REST介绍

  • Rest简介

  • WebMVC REST支持

  • REST内容协商

  • CORS

Spring Boot 2.0深度实践之核心技术篇【第六章 Web MVC REST应用 】
Spring Boot 2.0深度实践之核心技术篇【第六章 Web MVC REST应用 】

架构约束

  • 统一接口(Uniform interface)

  • C/S架构(Client-Server)

  • 无状态(Stateless)

    用户状态集中在客户端而不是服务端(服务端没有客户的会话状态),Http协议本来就是无状态的(和服务端没有关联)。
  • 可缓存(Cacheable)

  • 分层系统(Layered System)

  • 按需代码(Code On damand)//客户端的脚本

统一接口( Uniform interface)

  • 资源识别 ( Identification of resources )
    • URI( Uniform Resource ldentifier )
  • 资源操作 ( Manipulation of resources through representations )
    • HTTP verbs : GET、 PUT、 POST 、DELETE
  • 自描述消息 ( Self-descriptive messages )
    • Content-Type
    • MIME-Type
    • Media Type : application/javascript、 text/html
  • 超媒体( HATEOAS )
    • Hypermedia As The Engine Of Application State