华为云obs;
This commit is contained in:
@@ -332,11 +332,21 @@ public class MenuApi extends BaseController {
|
|||||||
"attachment; filename=\"" + filename + "\"")
|
"attachment; filename=\"" + filename + "\"")
|
||||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
.body(outputStream -> {
|
.body(outputStream -> {
|
||||||
//ObsClient obsClient = null;
|
ObsClient obsClient1 = null;
|
||||||
try {
|
try {
|
||||||
//obsClient = new ObsClient(accessKey, secretKey, endpoint);
|
System.out.println(
|
||||||
|
"AccessKey:" + obsProperties.getAccessKey() +
|
||||||
|
"SecretKey:" + obsProperties.getSecretKey()
|
||||||
|
+ "Endpoint:" + obsProperties.getEndpoint()
|
||||||
|
);
|
||||||
|
logger.error(
|
||||||
|
"AccessKey:" + obsProperties.getAccessKey() +
|
||||||
|
"SecretKey:" + obsProperties.getSecretKey()
|
||||||
|
+ "Endpoint:" + obsProperties.getEndpoint()
|
||||||
|
);
|
||||||
|
obsClient1 = new ObsClient(obsProperties.getAccessKey(), obsProperties.getSecretKey(), obsProperties.getEndpoint());
|
||||||
GetObjectRequest request = new GetObjectRequest(bucketName, objectKey);
|
GetObjectRequest request = new GetObjectRequest(bucketName, objectKey);
|
||||||
ObsObject obsObject = obsClient.getObject(request);
|
ObsObject obsObject = obsClient1.getObject(request);
|
||||||
|
|
||||||
try (InputStream inputStream = obsObject.getObjectContent()) {
|
try (InputStream inputStream = obsObject.getObjectContent()) {
|
||||||
byte[] buffer = new byte[8192];
|
byte[] buffer = new byte[8192];
|
||||||
|
|||||||
Reference in New Issue
Block a user