add(req-2119):下载接口API-调试7
This commit is contained in:
parent
5cedb11e8c
commit
03eb0c4caf
@ -315,9 +315,9 @@ public class WebFileController {
|
||||
@SneakyThrows
|
||||
@GetMapping("/v1/obs/downloadFileFromObs")
|
||||
@CrossOrigin
|
||||
public void downloadFileFromObs(@Valid DownloadFileFromObsRequest req, HttpServletResponse response) {
|
||||
public void downloadFileFromObs(@RequestParam("fileUuid") String fileUuId, HttpServletResponse response) {
|
||||
ServerFileDownloadDto dto = new ServerFileDownloadDto();
|
||||
dto.setFileKey(req.getFileKey());
|
||||
dto.setFileKey(fileUuId);
|
||||
ServerFileDownloadResponse result = fileService.getObject(dto, FileDownloadTypeEnum.STREAM_DOWNLOAD.getCode());
|
||||
try (OutputStream outputStream = response.getOutputStream(); InputStream inputStream = result.getFileStream()) {
|
||||
response.setContentType("image/jpg");
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
package cn.axzo.oss.http.api;
|
||||
|
||||
import cn.axzo.oss.http.model.DownloadFileFromObsRequest;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import feign.Response;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author axzo
|
||||
@ -19,8 +16,8 @@ import javax.validation.Valid;
|
||||
url = "http://oss:9123"
|
||||
)
|
||||
public interface DownloadFileApi {
|
||||
@RequestMapping("/webApi/v1/obs/downloadFileFromObs")
|
||||
CommonResponse<Response> downloadFileFromObs(@Valid @RequestBody DownloadFileFromObsRequest req);
|
||||
@GetMapping(value = "/webApi/v1/obs/downloadFileFromObs", consumes = MediaType.APPLICATION_PROBLEM_JSON_VALUE)
|
||||
CommonResponse<Response> downloadFileFromObs(@RequestParam("fileUuid") String fileUuId);
|
||||
|
||||
@GetMapping("/webApi/v1/obs/test")
|
||||
CommonResponse<String> test();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user