通过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")
PlayScala 2.5.x
点赞
收藏