PlayScala 2.5.x

  1. 通过routes文件定义

    GET /favicon.ico controllers.Assets.at(path="/public", file="favicon.ico") GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)

  2. 通过Assets生成的action访问

    controllers.Assets.versioned(path="/public", file="html/index.html")(request) controllers.Assets.at(path="/public", file="html/index.html")(request)

  3. 直接生成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")

评论

暂无评论