例子
/**
* 下载假期模板
*/
@ResponseBody
@RequestMapping(value = "/downloadDolidayTemplate.do")
public ResponseEntity downloadDolidayTemplate(Model model, HttpServletRequest request) throws Exception {
String path = this.getClass().getResource("/").getPath();
FileInputStream fis = new FileInputStream(path + "conf/template/holidayTemlate.xls");
byte[] data = new byte[fis.available()];
fis.read(data);
HttpHeaders he = new HttpHeaders();
he.setContentType(MediaType.valueOf("application/x-msdownload"));
he.set("content-disposition","attachment;filename="+URLEncoder.encode("模板.xls", "UTF-8"));
return new ResponseEntity<>(data, he, HttpStatus.OK);
}