I also had problems trying to service files created dynamically using an asset controller. I donβt know if it was for some kind of caching, but I finished writing my own controller and now it works fine.
I mean, I use the Assets controller for ordinary public files, and for its dynamically generated files, I use this:
public class FileService extends Controller { static String path = "/public/dynamicfiles/"; public static Result getFile(String file){ File myfile = new File (System.getenv("PWD")+path+file); return ok(myfile); } }
And the routes will be like this:
GET /files/:file controllers.FileService.getFile(file: String) GET /assets/*file controllers.Assets.at(path="/public", file) file: String) GET /files/:file controllers.FileService.getFile(file: String) GET /assets/*file controllers.Assets.at(path="/public", file)
It works fine for me
source share