@RequestMapping("/download.htm") app
public ResponseEntity<byte[]> download(HttpServletRequest request, @RequestParam("fileId") String fileId) throws IOException { spa
String path="E:\\Users\\xc\\workspace\\ldassetWeb\\WebRoot\\js\\time.js"; orm
File file=new File(path); htm
HttpHeaders headers = new HttpHeaders(); get
String fileName=new String("文件.js".getBytes("UTF-8"),"iso-8859-1");it
headers.setContentDispositionFormData("attachment", fileName); io
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); file
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), headers, HttpStatus.CREATED); request
} 下載
<a href="${ctx}/system/download.htm?fileId=188">下載</a>