4
我试图设置两个不同的静态资产路由,第二个失败。我错过了什么?Play Framework 2.0多个静态路由
要复制的问题:
开始从斯卡拉样品的hello world。
添加一行路线,所以现在有两条静态路由:
GET /assets/*file controllers.Assets.at(path="/public", file) GET /assets2/*file controllers.Assets.at(path="/public2", file)
注释掉main.scala.html资产的引用,所以它不会抱怨他们
公开和公开2文件。
$ cat > public/foo.txt hi $ mkdir public2 $ cp public/foo.txt public2
验证公共目录是否有效。
$ telnet localhost 9000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /assets/foo.txt HTTP/1.0 HTTP/1.1 200 OK Content-Length: 3 Content-Type: text/plain Etag: 5246040afe91a4cc93bd838a4d5db3984b99470b Cache-Control: no-cache hi Connection closed by foreign host.
验证第二个不起作用。
$ telnet localhost 9000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /assets2/foo.txt HTTP/1.0 HTTP/1.1 404 Not Found Content-Length: 0 Connection closed by foreign host.
我敢肯定有一些东西很明显这里,我“米只是没有看到它。
哦,我的上帝,固定。谢谢。 – 2012-04-17 14:19:17
我加对维基的一点点,以便为后代保留一段时间。 https://github.com/playframework/Play20/wiki/Assets – 2012-04-17 14:21:57
您可以更具体地了解PlaySettings将如何提供帮助? PlaySettings中没有字符串“playAssetsDirectories”或“baseDirectory /”。谢谢 – 2014-04-24 19:24:31