I am trying to serve static assets with Lagom. I added a play router using additional routers because play has support for serving assets from public folder.
But I can't use Assets.at function here because it is not static. After compiling code, I also don't see the assets jar, play suppose to create.
public class FileServerRouter implements SimpleRouter {
private final Router delegate;
@Inject
public FileServerRouter(RoutingDsl routingDsl) {
this.delegate =
routingDsl
.GET("/assets/*file")
.routingTo(
(request, file) -> {
// Assets.at(file);
return ok("Serving " + file);
})
.build()
.asScala();
}
@Override
public PartialFunction<RequestHeader, Handler> routes() {
return delegate.routes();
}
}
Does anyone know how to use Assets.at with RoutingDsl or any other way to serve static assets with lagom?