zoukankan      html  css  js  c++  java
  • Spring mvc文件下载

     @GetMapping("/download")
        ResponseEntity<InputStreamResource> downladFile() throws IOException {
    
            FileSystemResource file =new FileSystemResource("H:/个人简历/s.png");
            HttpHeaders httpHeaders = new HttpHeaders();
            httpHeaders.setCacheControl("no-cache,no-store,must-revalidate");
            httpHeaders.setContentType(MediaType.IMAGE_JPEG);
            httpHeaders.setContentLength(file.contentLength());
            httpHeaders.setContentDispositionFormData("attachment", URLEncoder.encode("妹妹.jpg","utf-8"));
            return ResponseEntity.ok()
                    .headers(httpHeaders)
                    .body(new InputStreamResource(file.getInputStream()));
        }
  • 相关阅读:
    函数之形参与实参
    函数的介绍与方法
    生活如戏
    zabbix中的sql
    1
    1
    通过snmpwalk抓取设备端口的流量状况
    abc
    as
    网络质量IP获取脚本
  • 原文地址:https://www.cnblogs.com/weibanggang/p/9944985.html
Copyright © 2011-2022 走看看