Browse Source

修改获取文件

Yangzw 1 month ago
parent
commit
d2858fd9f1

+ 4 - 1
feifan-framework/feifan-common/src/main/java/cn/newfeifan/mall/framework/common/util/servlet/ServletUtils.java

@@ -45,8 +45,11 @@ public class ServletUtils {
     public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException {
         // 设置 header 和 contentType
         if (filename.contains("mp4")) {
-            response.setHeader("Content-Disposition", "inline;Accept-Ranges: bytes;Cache-Control: no-store;Pragma: no-cache");
+            response.setHeader("Content-Disposition", "inline");
             response.setContentType("video/mp4");
+            response.setHeader("Accept-Ranges","bytes");
+            response.setHeader("Cache-Control","no-store");
+            response.setHeader("Pragma","no-cache");
         } else {
             response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);