Skip to content

Instantly share code, notes, and snippets.

@pyldin601
Forked from shazin/StreamingResponseBody
Created January 3, 2017 10:10
Show Gist options
  • Save pyldin601/8bc32a7688312913e4badbf448679266 to your computer and use it in GitHub Desktop.
Save pyldin601/8bc32a7688312913e4badbf448679266 to your computer and use it in GitHub Desktop.
@RequestMapping(method = RequestMethod.GET, value = "/{video:.+}")
public StreamingResponseBody stream(@PathVariable String video)
throws FileNotFoundException {
File videoFile = videos.get(video);
final InputStream videoFileStream = new FileInputStream(videoFile);
return (os) -> {
readAndWrite(videoFileStream, os);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment