I have the problem with video rewind on my site.
I figure out that problem with http headers.
My current controller method which returns video:
Try this simple code .
@GET
@Produces({"application/octet-stream"})
public Response getFile() {
File file = ...
return Response.ok(file, MediaType.APPLICATION_OCTET_STREAM)
.header("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"" ) .build();
}
Update :
Its wrapping the Spring Jersey jersey.java.net RESTful implementation with spring MVC.
For pure Spring mvc use below code.
@RequestMapping("/video") public ResponseEntity<byte[]> getvideo() throws IOException {
InputStream in = ...
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
return new ResponseEntity<byte[]>IOUtils.toByteArray(in),headers,HttpStatus.CREATED);
}
IOUtils is from apache common jar