调试 文件无法访问问题
This commit is contained in:
parent
4012c53116
commit
7b3dbb71ca
|
|
@ -59,6 +59,8 @@ public class FileTypeUtils {
|
|||
* @param content 附件内容
|
||||
*/
|
||||
public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException {
|
||||
System.out.println("filename@@"+filename);
|
||||
System.out.println("filename@@length"+content.length);
|
||||
// 设置 header 和 contentType
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
|
||||
String contentType = getMineType(content, filename);
|
||||
|
|
@ -69,6 +71,7 @@ public class FileTypeUtils {
|
|||
response.setHeader("Content-Range", String.valueOf(content.length - 1));
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
}
|
||||
|
||||
if (contentType.startsWith("image/")) {
|
||||
// 设置缓存
|
||||
response.setHeader("Cache-Control", "max-age=604800");
|
||||
|
|
|
|||
Loading…
Reference in New Issue