I like to integrate links to external files (PDF documents) in an existing Play Framework 2.4 application. The application is only used in-house.
To avoid 'Action not found' messages, do I have to specify the path in the routes configuration file?
What I've done so far:
I have added the route - for the existing javascript files i already have an assets entry.
GET /assets/plan/*file controllers.Assets.at(path="/home/entwickl", file)
GET /assets/*file controllers.Assets.at(path="/public", file)
Add unmanagedResourceDirectories in the build.sbt
unmanagedResourceDirectories in Assets += baseDirectory.value / "/home/entwickl"
And build the link in the html page
@if(sf.equalsIgnoreCase("S")) {
<a href="@routes.Assets.at("plan/PO_675245.pdf")" />LINK</a>
} else {
@sf
}
Now I get an compilation error:
Compilation error not enough arguments for method at: (path: String, file: String)play.api.mvc.Call.
Unspecified value parameter file.
src="@routes.Assets.at("javascripts/login.js")"></script>
Probably the two routes cannot be clearly distinguished from each other. But how do I do that? Thanks in advance.
Check this playframework doc:
Try to change this:
to something like this: