当前位置: 首页>>代码示例>>Java>>正文


Java HttpMethod.GET属性代码示例

本文整理汇总了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();
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:15,代码来源:S3DaoImpl.java

示例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);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:14,代码来源:GeneratePresignedUrlRequest.java


注:本文中的com.amazonaws.HttpMethod.GET属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。