Play Framework 2.0 multiple static routes
playframework-2.0, routes, scala
Solution
You should add `public2` folder to `playAssetsDirectories` in sbt config
playAssetsDirectories <+= baseDirectory / "public2"
See PlaySettings as an example.
Problem
I'm trying to set up two different static asset routes, and the second one fails. What am I missing? To duplicate the issue: start with the hello world from the scala samples. add a line to routes, so now there are two static routes: ``` GET /assets/*file controllers.Assets.at(path="/public", file) GET /assets2/*file controllers.Assets.at(path="/public2", file) ``` comment out the Assets references in main.scala.html, so it doesn't complain about them put a file in public and public2. ``` $ cat > public/foo.txt hi $ mkdir public2 $ cp public/foo.txt public2 ``` verify that the public dir works. ``` $ 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. ``` verify that the second one doesn't work. ``` $ 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. ``` I'm sure there's something obvious here, I"m just not seeing it.