diff --git a/.gitignore b/.gitignore index 00697e1..e6ebc35 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -。idea/ +.idea/ target/ *.iml \ No newline at end of file diff --git a/pom.xml b/pom.xml index efa49a5..07b9b11 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,7 @@ application*.yml application.yml + **/*.xml true @@ -166,13 +167,6 @@ test - - com.sun.xml.fastinfoset - FastInfoset - 1.2.18 - - - diff --git a/src/main/java/com/rabbiter/em/service/FileService.java b/src/main/java/com/rabbiter/em/service/FileService.java index 1832dd5..a1d38d3 100644 --- a/src/main/java/com/rabbiter/em/service/FileService.java +++ b/src/main/java/com/rabbiter/em/service/FileService.java @@ -92,9 +92,12 @@ public class FileService extends ServiceImpl { throw new ServiceException(constants.CODE_500,"文件不存在"); } try { - ServletOutputStream os = response.getOutputStream(); + response.reset(); response.addHeader("Content-Disposition","attachment;filename="+ URLEncoder.encode(fileName,"UTF-8")); response.setContentType("application/octet-stream"); + + ServletOutputStream os = response.getOutputStream(); + os.write(FileUtil.readBytes(file)); os.flush(); os.close(); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 5b31922..c968283 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -23,5 +23,5 @@ spring: connect-timeout: 30000ms file: - file: /home/fzhang5/file/file/ - avatar: /home/fzhang5/file/avatar/ + file: D:/devWorkSpace/file/ + avatar: D:/devWorkSpace/avatar/ diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3a386da..4e88f27 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,4 +7,4 @@ mybatis: map-underscore-to-camel-case: true spring: profiles: - active: @profile@ + active: test