Play Framework 框架 控制器(Controller)分析和总结.docx

Play Framework 框架 控制器(Controller)分析和总结.docx

  1. 1、本文档共23页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Play Framework 框架的控制器(Controller) Business logic is managed in the domain model layer. As a client (typically a web browser) cannot directly invoke this code, the functionality of a domain object is exposed as resources represented by URIs. 业务逻辑是在域模型层里进行管理,客户端(典型的客户端就是浏览器)无法直接调用业务逻辑代码,客户端是通过资源的 URI 来访问到域对象。 A client uses the uniform API provided by the HTTP protocol to manipulate these resources, and by implication the underlying business logic. However, this mapping of resources to domain objects is not a bijection: the granularity can be expressed at different levels, some resources may be virtuals, for some resources aliases may be defined… 客户端使用 HTTP 协议中提供的统一方法来访问这些特定资源,并隐式调用底 层的业务逻辑。但是这种 URI 资源到域对象之间的映射关系并不是双向的,其粒度可以使用不同的层次来表示。某些资源可以是虚拟的,也可以给资源定义一个别名… This is precisely the role played by the Controller layer: providing a glue between the domain model objects and transport layer events. As the Model layer, controllers are written in pure Java, making it easy to access or modify Model objects. Like the HTTP interface, Controllers are procedural and Request/Response oriented. 这正是控制器层所起的作用:提供一个域模型对象与传输层之间的映射关系。由于域模型层和控制器都是纯 Java 编写的,因此很容易访问或修改模型对象。与 HTTP 接口类似,控制器是面向过程和请求/响应模型的。 The Controller layer reduces the impedance mismatch between HTTP and the Domain Model. 控制器层可减少由于 HTTP 协议和域模型之间不匹配的障碍。 Note 注意 There are different architectural models with different strategies. Some protocols give you direct access to the domain model objects. This is typically what EJB or Corba protocols do. In these cases, the architectural style used is RPC (Remote Procedure Call). These communication styles are hardly compatible with web architecture. 不同的体系架构有着不同的设计策略,某些协议可以让你直接访问域模型对象, 例如 EJB 和 CORBA 协议就是这么做的。在这种情况下,使用的 RPC 远程过 程调用的设计风格,这种设计风格很难跟 Web 应用兼容。 Some technologies like SOAP try to give access to the model object domain through the Web. However, SOAP is just another RPC-style protocol, in this case using HTTP as a transport protocol. It is not an application protocol. 而另外一些技术例如

文档评论(0)

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

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

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

1亿VIP精品文档

相关文档