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