本文整理汇总了Java中com.amazonaws.HttpMethod.GET属性的典型用法代码示例。如果您正苦于以下问题:Java HttpMethod.GET属性的具体用法?Java HttpMethod.GET怎么用?Java HttpMethod.GET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.amazonaws.HttpMethod
的用法示例。
在下文中一共展示了HttpMethod.GET属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPreSignedUrl
@NotNull
@Override
public String getPreSignedUrl(@NotNull HttpMethod httpMethod, @NotNull String bucketName, @NotNull String objectKey, @NotNull Map<String, String> params) throws IOException {
try {
final Callable<String> resolver = () -> S3Util.withS3Client(params, client -> {
final GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, objectKey, httpMethod)
.withExpiration(new Date(System.currentTimeMillis() + getUrlLifetimeSec() * 1000));
return client.generatePresignedUrl(request).toString();
});
if (httpMethod == HttpMethod.GET) {
return TeamCityProperties.getBoolean(TEAMCITY_S3_PRESIGNURL_GET_CACHE_ENABLED)
? myGetLinksCache.get(getCacheIdentity(params, objectKey, bucketName), resolver)
: resolver.call();
} else {
return resolver.call();
}
} catch (Exception e) {
final AWSException awsException = new AWSException(e.getCause());
if (StringUtil.isNotEmpty(awsException.getDetails())) {
LOG.warn(awsException.getDetails());
}
final String err = "Failed to create " + httpMethod.name() + " pre-signed URL for [" + objectKey + "] in bucket [" + bucketName + "]";
LOG.infoAndDebugDetails(err, awsException);
throw new IOException(err + ": " + awsException.getMessage(), awsException);
}
}
开发者ID:JetBrains,项目名称:teamcity-s3-artifact-storage-plugin,代码行数:26,代码来源:S3PreSignedUrlProviderImpl.java
示例2: generateGetObjectPresignedUrl
@Override
public String generateGetObjectPresignedUrl(String bucketName, String key, Date expiration, S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto)
{
GeneratePresignedUrlRequest generatePresignedUrlRequest = new GeneratePresignedUrlRequest(bucketName, key, HttpMethod.GET);
generatePresignedUrlRequest.setExpiration(expiration);
AmazonS3Client s3 = getAmazonS3(s3FileTransferRequestParamsDto);
try
{
return s3Operations.generatePresignedUrl(generatePresignedUrlRequest, s3).toString();
}
finally
{
s3.shutdown();
}
}
示例3: GeneratePresignedUrlRequest
/**
* Creates a new request for generating a pre-signed URL that can be used as
* part of an HTTP GET request to access the Amazon S3 object stored under
* the specified key in the specified bucket.
*
* @param bucketName
* The name of the bucket containing the desired Amazon S3
* object.
* @param key
* The key under which the desired Amazon S3 object is stored.
*/
public GeneratePresignedUrlRequest(String bucketName, String key) {
this(bucketName, key, HttpMethod.GET);
}