In my application I need to serve a static file from public folder. And for some reasons I have to do it from Java controller action.
The first solution that came to my mind is to do something like:
public class Central extends Controller {
public static Result index() {
return Assets.at("/public", "central/index.html", false);
}
}
But Assets.at
method return type is play.api.mvc.Action<play.api.mvc.AnyContent>
Is there some way to transform it to type play.mvc.Result
?
Or any other elegant way to do serve static file from Java controller action ?