I'm using spring mvc and want to create a method which must return binary file. I've found some tutorials but nothing works for me. This is my part of my code:
@RequestMapping(value = "/get-frame/{fileId}", method = RequestMethod.GET)
public void getVideoFrame(@PathVariable("fileId") String filename,
HttpServletResponse response) throws IOException {
...
...
...
byte[] image = ...
OutputStream outputStream = response.getOutputStream();
outputStream.write(image);
outputStream.close();
response.flushBuffer();
}
This method always returns error 406. What's wrong?
Thanks