| | |
| | | package com.yssh.utils; |
| | | |
| | | import com.yssh.config.InitConfig; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.FileInputStream; |
| | |
| | | |
| | | public static void download(String file, String fileName, boolean inline, HttpServletResponse res) throws Exception { |
| | | if (StringUtils.isEmpty(fileName)) { |
| | | fileName = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date()); |
| | | fileName = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, InitConfig.getDate()); |
| | | } |
| | | fileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20"); |
| | | String dispose = inline ? "inline" : "attachment"; |