I want to display a docx-file on my browser. But I am having problem with the media type for docx-file.
This is my sample code:
@RequestMapping("/view")
public @ResponseBody HttpEntity<byte[]> view(@RequestParam(value = "fileId") int id) throws IOException {
FileDaoImplement fdi = new FileDaoImplement();
Files f = fdi.getFile(id);
byte[] document = f.getByte();
HttpHeaders header = new HttpHeaders();
header.setContentType("What should I use to show a docx file??");
header.set("Content-Disposition", "inline; filename=");
header.setContentLength(document.length);
return new HttpEntity<byte[]>(document, header);
}