我试图做一个特定的静态文件的路由,但我试图结束一个错误。路线到Play中的静态文件! 2.0
我做了3次不同的尝试:
1.
GET /file staticFile:/public/html/file.html
的错误,我得到:
Compilation error
string matching regex `\z' expected but `:' found
2.
GET /file controllers.Assets.at(path="/public/html", "file.html")
我得到的错误:
Compilation error
Identifier expected
3.
GET /file controllers.Assets.at(path="/public/html", file="file.html")
我得到的错误:(这是最古怪的)
Compilation error
not enough arguments for method at: (path: String, file: String)play.api.mvc.Call. Unspecified value parameter file.
关于第三个错误怪异的部分是,它是在一个不同的文件抛出( app/views/main.scala.html)在以下行上:
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
所有这些e方法在官方文档和/或线程中发现在stackoverflow上。 我在这里错过了什么?
谢谢。
我认为第三个错误发生在默认模板中提到公共路由的第一个实例。我有完全相同的问题。我期望你/我尝试添加静态链接会扰乱反向路由。 – flurdy 2012-03-31 19:14:46
什么?两年,没有被接受的答案。这个问题解决了吗? – Jus12 2014-10-05 16:19:14
@ Jus12对不起,这只是我没有继续使用游戏(不是我的选择,这是不幸的),我不知道哪个答案是正确的。那个得票最多的人当时没有解决问题(正如我的评论所解释的)。如果有人会让我知道任何答案是否正确,我会很乐意将其标记为已接受。 – 2014-10-05 17:10:08