孟令鑫 1 год назад
Родитель
Сommit
3e3fa18f64

+ 0 - 3
pom.xml

@@ -40,9 +40,6 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <configuration>
-                    <image>
-                        <builder>paketobuildpacks/builder-jammy-base:latest</builder>
-                    </image>
                     <excludes>
                         <exclude>
                             <groupId>org.projectlombok</groupId>

+ 2 - 2
src/main/java/com/cicv/oss/config/adapter/controller/OssController.java

@@ -24,8 +24,8 @@ public class OssController {
      * @param token
      * @return
      */
-    @GetMapping("/get")
-    public OssConfigInfo get(@RequestParam("token") String token) {
+    @GetMapping("/config")
+    public OssConfigInfo config(@RequestParam("token") String token) {
         if ("nXonLUcMtGcrQqqKiyygIwyVbvizE0wD".equals(token)) {
             return new OssConfigInfo(
                     ossConfig.getEndpoint(),

+ 7 - 6
src/main/java/com/cicv/oss/config/adapter/controller/RosController.java

@@ -18,17 +18,18 @@ import java.nio.file.Paths;
 @RequestMapping("/ros")
 public class RosController {
 
-    @Autowired
-    private ResourceLoader resourceLoader;
+//    @Autowired
+//    private ResourceLoader resourceLoader;
 
     @GetMapping("/config")
-    public void download(HttpServletResponse response, @RequestParam("fileName") String fileName) {
+    public void config(HttpServletResponse response) {
         try {
             response.setContentType("application/octet-stream;charset=utf-8");
-            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "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:your-file.txt");
-            InputStream inputStream = resource.getInputStream();
+//            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"));
             ServletOutputStream outputStream = response.getOutputStream();
             for (int bytesRead = inputStream.read(buffer); bytesRead >= 0; bytesRead = inputStream.read(buffer)) {
                 outputStream.write(buffer, 0, bytesRead);