相关疑难解决方法(0)

在Play中路由到静态文件!2.0

我正在尝试建立一个特定静态文件的路由,但我正在尝试的所有内容都以错误结束.

我做了3次不同的尝试:

1.

GET /file   staticFile:/public/html/file.html
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

Compilation error
string matching regex `\z' expected but `:' found
Run Code Online (Sandbox Code Playgroud)

2.

GET /file   controllers.Assets.at(path="/public/html", "file.html")
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

Compilation error
Identifier expected
Run Code Online (Sandbox Code Playgroud)

3.

GET /file   controllers.Assets.at(path="/public/html", file="file.html")
Run Code Online (Sandbox Code Playgroud)

我得到的错误:(这是最奇怪的)

Compilation error
not enough arguments for method at: (path: String, file: String)play.api.mvc.Call. Unspecified value parameter file.
Run Code Online (Sandbox Code Playgroud)

关于第3个错误的奇怪部分是它被抛出在以下行的不同文件(app/views/main.scala.html)中:

<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
Run Code Online (Sandbox Code Playgroud)

所有这些方法都可以在stackoverflow上的官方文档和/或线程中找到.我在这里错过了什么?

谢谢.

routes static-files playframework playframework-2.0

32
推荐指数
5
解决办法
3万
查看次数