|
@@ -17,8 +17,8 @@ import java.io.Serializable;
|
|
|
public class OSSService implements Serializable {
|
|
|
private String accessId = "LTAI5tHMkNaRhpiDB1yWMZPn";
|
|
|
private String accessKey = "XLi5YUJusVwbbQOaGeGsaRJ1Qyzbui";
|
|
|
- //private String endpoint = "https://oss-cn-hangzhou-internal.aliyuncs.com";
|
|
|
- private String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
|
|
|
+ private String endpoint = "https://oss-cn-hangzhou-internal.aliyuncs.com";
|
|
|
+ //private String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
|
|
|
|
|
|
public void upload(String bucketName, String localFile, String objectName) {
|
|
|
OSS ossClient = new OSSClientBuilder().build(endpoint, accessId, accessKey);
|
|
@@ -28,9 +28,6 @@ public class OSSService implements Serializable {
|
|
|
} catch (Exception e) {
|
|
|
log.error("upload error bucketName {}, localFile {}, objectName {}", bucketName, localFile, objectName, e);
|
|
|
}
|
|
|
- if (ossClient != null) {
|
|
|
- ossClient.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
public void download(String bucketName, String localFile, String objectName) {
|
|
@@ -41,9 +38,6 @@ public class OSSService implements Serializable {
|
|
|
} catch (Exception e) {
|
|
|
log.error("download error bucketName {}, localFile {}, objectName {}", bucketName, localFile, objectName, e);
|
|
|
}
|
|
|
- if (ossClient != null) {
|
|
|
- ossClient.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|