code: public static void initFileSendHeader(HttpServletResponse res, String filename, String contentType) {
  
          filename = getEncodingFileName(filename);
          if (contentType != null) {
              res.setContentType(contentType);
          } else {
              res.setContentType("applicaiton/download;charset=utf-8");
          }
          res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";");
          res.setHeader("Content-Transfer-Encoding", "binary");
          res.setHeader("file-name", filename);
  
      }
docs: Init file send header.
  
  @param res         the res
  @param filename    the filename
  @param contentType the content type