PlayScala 2.5.x
文章目录
通过routes文件定义
GET /favicon.ico controllers.Assets.at(path="/public", file="favicon.ico") GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
通过Assets生成的action访问
controllers.Assets.versioned(path="/public", file="html/index.html")(request) controllers.Assets.at(path="/public", file="html/index.html")(request)
直接生成File Result
Ok.sendFile(new File("public/html/index.html")).as("text/html; charset=UTF-8") Ok.sendPath(Paths.get("public/html/index.html")).as("text/html; charset=UTF-8")
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论