孟令鑫 1 år sedan
förälder
incheckning
7a5e1173e7

+ 13 - 8
src/main/java/com/cicv/oss/config/adapter/controller/RosController.java

@@ -27,7 +27,7 @@ public class RosController {
         try {
             response.setContentType("application/octet-stream;charset=utf-8");
             response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("config.yaml", "utf-8"));
-            byte[] buffer = new byte[1024];
+            byte[] buffer = new byte[10000];
 //            org.springframework.core.io.Resource resource = resourceLoader.getResource("classpath:config.yaml");
 //            InputStream inputStream = resource.getInputStream();
             InputStream inputStream = Files.newInputStream(Paths.get("/mnt/disk001/oss-config/yaml/config.yaml"));
@@ -41,16 +41,21 @@ public class RosController {
     }
 
     @GetMapping("/configString")
-    public String configString(HttpServletResponse response) {
+    public String configString() {
         try {
-            response.setContentType("application/octet-stream;charset=utf-8");
-            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("config.yaml", "utf-8"));
-            byte[] buffer = new byte[1024];
-//            org.springframework.core.io.Resource resource = resourceLoader.getResource("classpath:config.yaml");
-//            InputStream inputStream = resource.getInputStream();
             InputStream inputStream = Files.newInputStream(Paths.get("/mnt/disk001/oss-config/yaml/config.yaml"));
-            return MyFileUtil.read(inputStream);
+            return MyFileUtil.read(inputStream, 10000);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
 
+
+    @GetMapping("/configString2")
+    public String configString2() {
+        try {
+            InputStream inputStream = Files.newInputStream(Paths.get("/mnt/disk001/oss-config/yaml/config2.yaml"));
+            return MyFileUtil.read(inputStream, 10000);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }

+ 2 - 1
src/main/resources/application.yaml

@@ -1,7 +1,8 @@
 
 
 oss:
-  endpoint: "http://open-bucket.oss.icvdc.com:9080"
+  endpoint: "http://open-bucket.oss.icvdc.com"
+#  endpoint: "http://1.202.169.136"
   access-key-id: "n8glvFGS25MrLY7j"
   access-key-secret: "xZ2Fozoarpfw0z28FUhtg8cu0yDc5d"
   bucket-name: "open-bucket"