|
|
@@ -1,23 +1,18 @@
|
|
|
package cn.reghao.dfs.store.oss.controller;
|
|
|
|
|
|
-import cn.reghao.dfs.store.oss.model.FileMeta;
|
|
|
import cn.reghao.dfs.store.oss.model.object.DeleteObjects;
|
|
|
-import cn.reghao.dfs.store.oss.service.ObjectService;
|
|
|
import cn.reghao.dfs.store.oss.service.ObjectServiceImpl;
|
|
|
import cn.reghao.jutil.jdk.result.WebBody;
|
|
|
+import cn.reghao.jutil.web.ServletUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.rocksdb.RocksDBException;
|
|
|
-import org.springframework.core.io.InputStreamResource;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.MediaType;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
/**
|
|
|
* @author reghao
|
|
|
@@ -34,8 +29,12 @@ public class ObjectController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation("上传对象")
|
|
|
- @PutMapping(value = "/{objectName:.+}")
|
|
|
- public String putObject(@PathVariable("objectName") String objectName, MultipartFile file) throws Exception {
|
|
|
+ @PutMapping(value = "/**")
|
|
|
+ public String putObject(MultipartFile file) throws Exception {
|
|
|
+ String uri = ServletUtil.getRequest().getRequestURI();
|
|
|
+ String uri1 = URLDecoder.decode(uri, StandardCharsets.UTF_8);
|
|
|
+
|
|
|
+ String objectName = uri1.replace("/object", "");
|
|
|
objectService.putObject(objectName, file);
|
|
|
return WebBody.success();
|
|
|
}
|
|
|
@@ -89,8 +88,12 @@ public class ObjectController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取对象")
|
|
|
- @GetMapping(value = "/{objectName:.+}")
|
|
|
- public void getObject(@PathVariable("objectName") String objectName) throws RocksDBException, IOException {
|
|
|
+ @GetMapping(value = "/**")
|
|
|
+ public void getObject() throws RocksDBException, IOException {
|
|
|
+ String uri = ServletUtil.getRequest().getRequestURI();
|
|
|
+ String uri1 = URLDecoder.decode(uri, StandardCharsets.UTF_8);
|
|
|
+
|
|
|
+ String objectName = uri1.replace("/object", "");
|
|
|
objectService.getObject(objectName);
|
|
|
}
|
|
|
|