登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

阿弥陀佛

街树飘影未见尘 潭月潜水了无声 般若观照心空静...

 
 
 

日志

 
 
关于我

一直从事气象预报、服务建模实践应用。 注重气象物理场、实况场、地理信息、本体知识库、分布式气象内容管理系统建立。 对Barnes客观分析, 小波,计算神经网络、信任传播、贝叶斯推理、专家系统、网络本体语言有一定体会。 一直使用Java、Delphi、Prolog、SQL编程。

play 常见概念学习  

2013-08-19 18:56:19|  分类: play |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

学习书本参见
工具:bootstrap,
代码下载:Play for scala

Assets : 静态资源控制对象。provides caching, ETag, gzip compression and JavaScript minification support.
def at(path: String, file: String): Action[AnyContent]获取资源。Generates an Action that serves a static resource。
实现步骤:
1. 在conf/routes文件中加入:
 GET  /assets/*file        controllers.Assets.at(path="/public", file)
 *代表.* regular expression
2. 资源获取。如果请求 GET /assets/javascripts/jquery.js 服务,则router激活controllers.Assets.at("/public", "javascripts/jquery.js")
3. 逆变。用于模板代码。例如:
    <script src="http://hxfcalf.blog.163.com/blog/@routes.Assets.at("javascripts/jquery.js")"></script>
    将产生:
    <script src="/assets/javascripts/jquery.js"></script>
 参见: Play for Scala developers,Application global settings
 
Action : 是一个函数对象。用于处理来自网页的请求,并返回状态结果到客户端浏览器。
例如:
val echo = Action { request =>
  Ok("Got request [" + request + "]")
}

Request:客户端请求。例如:
headers: Headers
id: Long   The request ID.
method: String The HTTP method
path: String The URI path.
queryString: Map[String, Seq[String]]
remoteAddress: String The client IP address.
tags: Map[String, String] The request Tags.
uri: String The complete request URI, containing both path and query string.
accept: Seq[String]
charset: Option[String]
flash: Flash
.....

Status:状态值。例如:Ok :Int = 200。 Status状态对象定义了许多状态值。(如:ACCEPTED: Int  ,NOT_IMPLEMENTED: Int . NOT_FOUND: Int, Ok:Int )
Results:返回状态值的Helper对象。例如:返回Ok: Status,Accepted: Status , Async(promise: Future[Result]): AsyncResult 

 

  评论这张
 
阅读(730)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018