Processing dynamically created files in Game 2

I wrote a small application that creates a downloadable pdf files with playback 2.0

I want to serve them to the public. In my development environment I created a folder in the / assets / folder, and everything worked well.

Now that I switched to production, I realized that the game always deploys these files behind me.

Do I need to write your own controller for the maintenance of these files or here?

+3
source share
1 answer

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

+4
source

All Articles