使用资源 URL - Java SDK 删除 AWS S3 资源
Deleting AWS S3 Resource with Resource URL - Java SDK
有没有办法通过 URL 使用 java SDK 从 AWS S3 中删除资源?
我知道您可以像这样使用存储桶名称和密钥名称删除资源:
s3client.deleteObject(new DeleteObjectRequest(bucketName, keyName));
问题是我只能访问资源URL,所以我需要操作字符串来提取存储桶名称和键名称。
但是,如果有一种方法可以通过传递 url 来删除,那就更干净了。
似乎没有办法简单地传递 URL。
还有这个:
AmazonS3URI
public AmazonS3URI(String str)
Creates a new AmazonS3URI by parsing the given string. String will be URL encoded before generating the URI.
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3URI.html
你可以在上面调用getKey
和getBucket
来提取你需要的字符串。它仍然很乱,但至少看起来你不必编写自己的解析器。
有没有办法通过 URL 使用 java SDK 从 AWS S3 中删除资源?
我知道您可以像这样使用存储桶名称和密钥名称删除资源:
s3client.deleteObject(new DeleteObjectRequest(bucketName, keyName));
问题是我只能访问资源URL,所以我需要操作字符串来提取存储桶名称和键名称。
但是,如果有一种方法可以通过传递 url 来删除,那就更干净了。
似乎没有办法简单地传递 URL。
还有这个:
AmazonS3URI
public AmazonS3URI(String str)
Creates a new AmazonS3URI by parsing the given string. String will be URL encoded before generating the URI.
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3URI.html
你可以在上面调用getKey
和getBucket
来提取你需要的字符串。它仍然很乱,但至少看起来你不必编写自己的解析器。