/**
* 文件下载
*/
@RequestMapping(value="/download")
public ResponseEntity downLoad(String filePath,String fileName,HttpServletRequest request, HttpServletResponse response){
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
FileInputStream file=null;
FileChannel fischannel=null;
try {
//获取文件类型
String mimeType = request.getServletContext().getMimeType(fileName
springmvc通过nio实现文件下载
最新推荐文章于 2021-07-24 16:30:10 发布