fixbug upload file

This commit is contained in:
limqhz
2021-03-28 15:10:13 +08:00
parent 966925e482
commit c04a284369
2 changed files with 1 additions and 27 deletions

View File

@@ -147,27 +147,4 @@ public class AppVenueLessonController {
}
return venueItems;
}
/**
* 查询数据库
*/
@RequestMapping(value = "/fetchFile/{fileUrl}", method = {RequestMethod.GET,RequestMethod.POST})
public void fetchFile(String fileUrl, HttpServletResponse response) throws IOException {
String findFile = url + healthDir + fileUrl;
InputStream inputStream = Request.Get(findFile).execute().returnContent().asStream();
ServletOutputStream servletOutputStream = response.getOutputStream();
if (inputStream != null && servletOutputStream != null) {
int temp = 0;
// 开始拷贝
while ((temp = inputStream.read()) != -1) {
// 边读边写
servletOutputStream.write(temp);
}
// 关闭输入输出流
inputStream.close();
servletOutputStream.flush();
servletOutputStream.close();
}
}
}