@RequestMapping(value = "/downloadSvt")

public ResponseEntity<FileSystemResource> export() {

 

HttpHeaders headers = new HttpHeaders();

headers.add("Cache-Control", "no-cache, no-store, must-revalidate");

headers.add("Content-Disposition", "attachment; filename=client.js");

headers.add("Pragma", "no-cache");

headers.add("Expires", "0");

File file = new File("./client.js");

return ResponseEntity.ok().headers(headers).contentLength(file.length())

.contentType(MediaType.parseMediaType("application/octet-stream")).body(new FileSystemResource(file));

}

posted on 2018-03-18 16:27  wblade  阅读(245)  评论(0编辑  收藏  举报