Play Framework 框架 路由(Route)分析和总结.docx

Play Framework 框架 路由(Route)分析和总结.docx

  1. 1、本文档共10页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
HTTP 路 由 HTTP routing 路由组件负责将 HTTP 请求交给对应的 action 处理(一个控制器的静态公共方法) The router is the component in charge of translating incoming HTT P Requests into action calls (a static, public method of a Contro ller). 一个 HTTP 请求在 MVC 框架里被当做一个事件看待。事件包含2 个方面的信息 请求的路径(例如/clients/1524,/photos/list),包含查询字符串(参数字符串) HTTP 方法(GET,POST,PUT,DELETE) An HTTP request is seen as an event by the MVC framework. The eve nt contains two major pieces of information: The Request path (such as /clients/1542, /photos/list), includi ng the query string. The HTTP method (GET, POST, PUT, DELETE) 关 于 REST About REST 表述性状态转移(REST)是一种类似互联网的分布式超媒体软件架构风格, Representational state transfer (REST) is a style of software arc hitecture for distributed hypermedia systems such as the World Wi de Web. REST 的几个关键性地方设计准则: 应用功能分散在资源中 每个资源使用一个唯一的 URI 来寻址 所有资源在客户端和资源之间使用一个统一的接口来转移状态 REST states a few key design principles: Application functionality is divided into resources Every resource is uniquely addressable using an URI All resources share a uniform interface for the transfer of sta te between client and resource. 如果你使用过 HTTP,这些接口定义了一些可用的HTTP 方法。这些协议用于访问资源的状态: *客户端-服务端 *无状态 *缓存 *分层 If you?re using HTTP, these interfaces are defined by the set of available HTTP methods. The protocol used to access the resource state is: Client-server Stateless Cacheable Layered 如果一个应用遵循了 REST 的主要设计准则,那么这个应用就是REST 风格的。Play 框架使构建 REST 风格的应用变得更容易: *Play 的路由解释 URI 和 HTTP 方法,将一个请求匹配给一个Java 调用。基于正则 表达式的 URI 模式匹配给你更过的灵活性。 *协议时无状态的,意味着你不能在2 次成功的请求之间在服务器上保存任何状态。 *Play 把 HTTP 当做关键特性,这样框架可以让你接触到HTTP 的所有信息。If an application follows the main REST design principles, the ap plication is RESTFul. The Play framework makes it easy to build R ESTFul applications: The Play router interprets both URI and HTTP methods to route a request to a Java call. Regular expressions-based URI patterns g ive you even more flexibility. The protocol is stateless. This means you can?t save any state on the server between two successive requests. Play considers HTTP as a

文档评论(0)

tianya189 + 关注
官方认证
内容提供者

该用户很懒,什么也没介绍

认证主体阳新县融易互联网技术工作室
IP属地上海
统一社会信用代码/组织机构代码
92420222MA4ELHM75D

1亿VIP精品文档

相关文档