Example #1
0
 // 文件的下载
 @RequestMapping("download")
 public ResponseEntity<byte[]> download() throws IOException {
   File file = new File("d:/PLSQLDeveloper.zip");
   HttpHeaders headers = new HttpHeaders();
   headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
   headers.setContentDispositionFormData("attachment", "dict.txt");
   headers.setContentLength(file.length());
   return new ResponseEntity<byte[]>(
       FileUtils.readFileToByteArray(file), headers, HttpStatus.CREATED);
 }