|
@@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.InputStream;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -285,14 +286,16 @@ public class CompatibleOldFileServiceImpl implements CompatibleOldFileService {
|
|
|
return;
|
|
|
}
|
|
|
// 3.通过文件流的方式下载文件
|
|
|
- // IoUtil.copy(service.download(fileInfo.getFileBucket(),fileInfo.getFilePath()),response.getOutputStream());
|
|
|
+ IoUtil.copy(service.download(fileInfo.getFileBucket(),fileInfo.getFilePath()),response.getOutputStream());
|
|
|
+ response.setHeader(CommonConstant.REPONSE_HEAD_CONTENT_DISPOSITION,
|
|
|
+ CommonConstant.REPONSE_HEAD_CONTENT_DISPOSITION_ATTACHMENT + URLEncoder.encode(fileInfo.getFileName(), "UTF-8"));
|
|
|
// 4.2021年12月22日12:00:21,先申请下载地址,然后通过重定向的方式直接请求文件服务器进行下载
|
|
|
- String fetchUrl = service.fetchUrl(fileInfo.getFileBucket(), fileInfo.getFilePath());
|
|
|
- if (StrUtil.isBlank(fetchUrl)){
|
|
|
- IoUtil.writeUtf8(response.getOutputStream(),Boolean.FALSE,"File not existed");
|
|
|
- return;
|
|
|
- }
|
|
|
- response.sendRedirect(fetchUrl);
|
|
|
+// String fetchUrl = service.fetchUrl(fileInfo.getFileBucket(), fileInfo.getFilePath());
|
|
|
+// if (StrUtil.isBlank(fetchUrl)){
|
|
|
+// IoUtil.writeUtf8(response.getOutputStream(),Boolean.FALSE,"File not existed");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// response.sendRedirect(fetchUrl);
|
|
|
}
|
|
|
|
|
|
/***
|