我正在使用芥末进行文件存储,我需要将AWS 开发工具包客户端主机 URL 更改为芥末的 URL。我怎样才能做到这一点?
AmazonS3Client s3client = new AmazonS3Client(new AWSCredentials() {
@Override
public String getAWSAccessKeyId() {
return accessKey;
}
@Override
public String getAWSSecretKey() {
return secretKey;
}
});
/// Tried this but its not changing the endpoint and its still showing as aws s3 default endpoint.
s3client.setEndpoint(String.format("https://s3.wasabisys.com", Regions.US_EAST_1));
s3client.setRegion(Region.getRegion(Regions.US_EAST_1));
File fileToUpload = new File(filePath);
PutObjectRequest putRequest = new PutObjectRequest("ALPHA", "upload/" +
fileToUpload.getName(), fileToUpload);
PutObjectResult putResponse = s3client.putObject(putRequest);
putResponse.getContentMd5();