获取文件流接口优化调整
This commit is contained in:
parent
76ad1d78f1
commit
413632196e
@ -25,7 +25,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.Part;
|
||||
import javax.validation.Valid;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -112,14 +111,12 @@ public class WebFileController {
|
||||
@SneakyThrows
|
||||
@GetMapping("/v1/file/download")
|
||||
@CrossOrigin
|
||||
//@PreBuildContext
|
||||
public void download(@Valid ServerFileDownloadDto dto, HttpServletResponse response) {
|
||||
ServerFileDownloadResponse result = fileService.download(dto);
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
try {
|
||||
inputStream = result.getFileStream();
|
||||
//response.setContentType("application/x-download");
|
||||
response.setContentType("image/jpg");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + result.getFileName() + "." + result.getFileFormat());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user