From 1010ccca4dfa63f68f3caa87ddaadcfbe33405a5 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 26 十一月 2021 13:34:18 +0800 Subject: [PATCH] update 更新 RedisUtils set保留ttl 兼容 5.X redis版本 --- ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java index dc3aea2..ff56a2a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java @@ -10,20 +10,18 @@ /** * 鏂囦欢澶勭悊宸ュ叿绫� * - * @author ruoyi + * @author Lion Li */ -public class FileUtils extends FileUtil -{ +public class FileUtils extends FileUtil { /** * 涓嬭浇鏂囦欢鍚嶉噸鏂扮紪鐮� * - * @param response 鍝嶅簲瀵硅薄 + * @param response 鍝嶅簲瀵硅薄 * @param realFileName 鐪熷疄鏂囦欢鍚� * @return */ - public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException - { + public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException { String percentEncodedFileName = percentEncode(realFileName); StringBuilder contentDispositionValue = new StringBuilder(); @@ -34,7 +32,10 @@ .append("utf-8''") .append(percentEncodedFileName); + response.addHeader("Access-Control-Allow-Origin", "*"); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename"); response.setHeader("Content-disposition", contentDispositionValue.toString()); + response.setHeader("download-filename", percentEncodedFileName); } /** @@ -43,8 +44,7 @@ * @param s 闇�瑕佺櫨鍒嗗彿缂栫爜鐨勫瓧绗︿覆 * @return 鐧惧垎鍙风紪鐮佸悗鐨勫瓧绗︿覆 */ - public static String percentEncode(String s) throws UnsupportedEncodingException - { + public static String percentEncode(String s) throws UnsupportedEncodingException { String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); return encode.replaceAll("\\+", "%20"); } -- Gitblit v1.9.3