martin 3 jaren geleden
bovenliggende
commit
1da9cd8ed4

+ 3 - 8
simulation-resource-common/src/main/java/com/css/simulation/resource/common/controller/MinioController.java

@@ -118,14 +118,9 @@ public class MinioController {
     }
 
     @RequestMapping("/preview")
-    public void preview(@RequestParam("objectName") String objectName, HttpServletResponse response) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
-        InputStream inputStream = MinioUtil.downloadToStream(
-                minioClient,
-                bucketName,
-                objectName
-        );
-        String fileName = FileUtil.getFileName(objectName);
-        FileUtil.downloadForHttp(fileName, inputStream, response, 1024);
+    public ResponseBodyVO<String> preview(@RequestBody @Validated MinioParameter minioParameter) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
+        String previewUrl = MinioUtil.getPreviewUrl(minioClient, Method.GET, bucketName, minioParameter.getObjectName());
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, previewUrl);
     }
 
     @RequestMapping("/createMultipartUpload")