添加响应头:

response.addHeader("Content-Disposition", "attachment; filename=" + response.encodeURL(downloadfile));

   private void genCode(HttpServletResponse response, byte[] data) throws IOException
    {
        response.reset();
        response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
        response.addHeader("Content-Length", "" + data.length);
        response.setContentType("application/octet-stream; charset=UTF-8");
        IOUtils.write(data, response.getOutputStream());
    }

 

相关文章:

  • 2021-09-07
  • 2022-12-23
  • 2021-10-19
  • 2021-07-25
  • 2021-11-18
  • 2022-03-05
猜你喜欢
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案