2

Is it possible to add file to directory that is routed by assets controller and make it visible at runtime? It works with sbt run, but not working while process is running after sbt compile (assets folder is compiled)

fofizotu
  • 21
  • 1
  • This might help http://stackoverflow.com/questions/21551854/add-specific-directory-and-its-content-to-universal-target/42754634#42754634 – ObjectiveTruth Mar 12 '17 at 23:54

1 Answers1

0

I had a similar issue, I solved implementing my own assets resolver serving files from an host folder I declared.

Serving static content is pretty straightforward, according to documentation is as simple as writing a Controller method like:

public Result getStaticFile(String path){
   return ok(new File(path));
}

Pay attention in case you have to serve a file with 206: Partial content (e.g. a video file). In this case Play offer this utility method:

return RangeResults.ofFile(videoFile);
lbaggi
  • 78
  • 6