|
@@ -78,7 +78,9 @@ public class SceneController extends BaseController{
|
|
|
@GetMapping("/downMD5")
|
|
|
public void downMD5(@RequestParam(required = false) String num,
|
|
|
HttpServletResponse res, HttpServletRequest req) throws IOException {
|
|
|
- OutputStream os = res.getOutputStream();
|
|
|
+
|
|
|
+ // 设置响应头,指定文件类型和内容长度
|
|
|
+ OutputStream os = null;
|
|
|
try {
|
|
|
String sceneObjPath = String.format(FilePath.OBJ_OSS_PATH, "num")+"/data/scene.json" ;
|
|
|
|
|
@@ -91,6 +93,10 @@ public class SceneController extends BaseController{
|
|
|
fileInfo.setSize(size);
|
|
|
String objPath = String.format(FilePath.OBJ_LOCAL_PATH,environment , "num") ;
|
|
|
File file = new File(objPath +"/"+num + "_hash.txt");
|
|
|
+
|
|
|
+ res.setContentType("application/octet-stream");
|
|
|
+ res.setHeader("Content-Disposition", "attachment; filename="+num + "_hash.txt");
|
|
|
+ os = res.getOutputStream();
|
|
|
FileUtil.writeString(fileInfo.toString(),file,"UTF-8");
|
|
|
os.write(FileUtils.readFileToByteArray(file));
|
|
|
os.flush();
|