Jose Cabrera Zuniga Jose Cabrera Zuniga - 11 months ago 103
Scala Question

can't access play-scala public folder resources

For my play-scala project, My routes file has:

GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)


however, I am not able to retrieve any resource from this folder. For example, I placed a png file calleg favicon.png in the public folder, yet, if I run

http://localhost:9000/public/favicon.png


the play server can't find the resource. Any ideas about what to look for to repair this problem?

The server also says that tried the route:

GET/assets/$file<.+>controllers.Assets.versioned(path:String = "/public", file:Asset)


But no luck.

Answer Source

You are reading your configuration wrong, the correct request would look like this:

http://localhost:9000/assets/favicon.png

That way favicon.png will be searched in public folder, not another way around

If you want your original URL to work, you'll need to change your configuration to following:

GET     /public/*file               controllers.Assets.versioned(path="/public", file: Asset)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download