• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Headers类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.s3.Headers的典型用法代码示例。如果您正苦于以下问题:Java Headers类的具体用法?Java Headers怎么用?Java Headers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Headers类属于com.amazonaws.services.s3包,在下文中一共展示了Headers类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: populateMetadataWithEncryptionParams

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
private void populateMetadataWithEncryptionParams(ObjectMetadata source, ObjectMetadata destination) {
    Map<String, String> userMetadataSource = source.getUserMetadata();
    Map<String, String> userMetadataDestination = destination.getUserMetadata();

    String[] headersToCopy = { Headers.CRYPTO_CEK_ALGORITHM,
            Headers.CRYPTO_IV, Headers.CRYPTO_KEY, Headers.CRYPTO_KEY_V2,
            Headers.CRYPTO_KEYWRAP_ALGORITHM, Headers.CRYPTO_TAG_LENGTH,
            Headers.MATERIALS_DESCRIPTION,
            Headers.UNENCRYPTED_CONTENT_LENGTH,
            Headers.UNENCRYPTED_CONTENT_MD5 };

    if (userMetadataSource != null) {
        if(userMetadataDestination == null){
            userMetadataDestination= new HashMap<String,String>();
            destination.setUserMetadata(userMetadataDestination);
        }

        String headerValue;
        for(String header : headersToCopy){
            headerValue = userMetadataSource.get(header);
            if(headerValue != null){
                userMetadataDestination.put(header, headerValue);
            }
        }
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:27,代码来源:CopyCallable.java


示例2: handle

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
@Override
public AmazonWebServiceResponse<HeadBucketResult> handle(HttpResponse response)
        throws Exception {
    final AmazonWebServiceResponse<HeadBucketResult> awsResponse = new AmazonWebServiceResponse<HeadBucketResult>();
    final HeadBucketResult result = new HeadBucketResult();
    result.setBucketRegion(response.getHeaders().get(Headers.S3_BUCKET_REGION));

    if (!StringUtils.isNullOrEmpty(response.getHeaders().get(Headers.IBM_SSE_KP_ENABLED))){
    	result.setIBMSSEKPEnabled(Boolean.parseBoolean(response.getHeaders().get(Headers.IBM_SSE_KP_ENABLED)));
    }
    if (!StringUtils.isNullOrEmpty(response.getHeaders().get(Headers.IBM_SSE_KP_CUSTOMER_ROOT_KEY_CRN))){
    	result.setIBMSSEKPCrk(response.getHeaders().get(Headers.IBM_SSE_KP_CUSTOMER_ROOT_KEY_CRN));
    }
    awsResponse.setResult(result);

    return awsResponse;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:18,代码来源:HeadBucketResultHandler.java


示例3: getContentRange

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * <p>
 * Returns the content range of the object if response contains the Content-Range header.
 * </p>
 * <p>
 * If the request specifies a range or part number, then response returns the Content-Range range header.
 * Otherwise, the response does not return Content-Range header.
 * </p>
 * @return
 * 		Returns content range if the object is requested with specific range or part number,
 * 		null otherwise.
 */
public Long[] getContentRange() {
    String contentRange = (String) metadata.get(Headers.CONTENT_RANGE);
    Long[] range = null;
    if (contentRange != null) {
        String[] tokens = contentRange.split("[ -/]+");
        try {
            range = new Long[] { Long.parseLong(tokens[1]), Long.parseLong(tokens[2]) };
        } catch (NumberFormatException nfe) {
            throw new SdkClientException(
                    "Unable to parse content range. Header 'Content-Range' has corrupted data" + nfe.getMessage(),
                    nfe);
        }
    }
    return range;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:28,代码来源:ObjectMetadata.java


示例4: toJsonString

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * Returns the json string in the latest format.
 */
private String toJsonString() {
    Map<String, String> map = new HashMap<String, String>();
    byte[] encryptedCEK = getEncryptedCEK();
    map.put(Headers.CRYPTO_KEY_V2, Base64.encodeAsString(encryptedCEK));
    byte[] iv = cipherLite.getIV();
    map.put(Headers.CRYPTO_IV, Base64.encodeAsString(iv));
    map.put(Headers.MATERIALS_DESCRIPTION, kekMaterialDescAsJson());
    // The CRYPTO_CEK_ALGORITHM, CRYPTO_TAG_LENGTH and
    // CRYPTO_KEYWRAP_ALGORITHM were not available in the Encryption Only
    // (EO) implementation
    ContentCryptoScheme scheme = getContentCryptoScheme();
    map.put(Headers.CRYPTO_CEK_ALGORITHM, scheme.getCipherAlgorithm());
    int tagLen = scheme.getTagLengthInBits();
    if (tagLen > 0)
        map.put(Headers.CRYPTO_TAG_LENGTH, String.valueOf(tagLen));
    String keyWrapAlgo = getKeyWrappingAlgorithm();
    if (keyWrapAlgo != null)
        map.put(Headers.CRYPTO_KEYWRAP_ALGORITHM, keyWrapAlgo);
    return Jackson.toJsonString(map);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:24,代码来源:ContentCryptoMaterial.java


示例5: createExceptionFromHeaders

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
private AmazonS3Exception createExceptionFromHeaders(
        HttpResponse errorResponse, String errorResponseXml) {
    final Map<String, String> headers = errorResponse.getHeaders();
    final int statusCode = errorResponse.getStatusCode();
    final AmazonS3ExceptionBuilder exceptionBuilder = new AmazonS3ExceptionBuilder();
    exceptionBuilder.setErrorMessage(errorResponse.getStatusText());
    exceptionBuilder.setErrorResponseXml(errorResponseXml);
    exceptionBuilder.setStatusCode(statusCode);
    exceptionBuilder
            .setExtendedRequestId(headers.get(Headers.EXTENDED_REQUEST_ID));
    exceptionBuilder.setRequestId(headers.get(Headers.REQUEST_ID));
    exceptionBuilder.setCloudFrontId(headers.get(Headers.CLOUD_FRONT_ID));
    exceptionBuilder
            .setErrorCode(statusCode + " " + errorResponse.getStatusText());
    exceptionBuilder.addAdditionalDetail(Headers.S3_BUCKET_REGION,
            errorResponse.getHeaders().get(Headers.S3_BUCKET_REGION));
    return exceptionBuilder.build();
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:19,代码来源:S3ErrorResponseHandler.java


示例6: handle

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * @see com.amazonaws.http.HttpResponseHandler#handle(com.amazonaws.http.HttpResponse)
 */
public AmazonWebServiceResponse<T> handle(HttpResponse response) throws Exception {
    AmazonWebServiceResponse<T> awsResponse = parseResponseMetadata(response);
    responseHeaders = response.getHeaders();

    if (responseUnmarshaller != null) {
        log.trace("Beginning to parse service response XML");
        T result = responseUnmarshaller.unmarshall(response.getContent());
        log.trace("Done parsing service response XML");
        awsResponse.setResult(result);
        
        if (result instanceof ObjectListing) {
        	if (!StringUtils.isNullOrEmpty(responseHeaders.get(Headers.IBM_SSE_KP_ENABLED))){
        		((ObjectListing) result).setIBMSSEKPEnabled(Boolean.parseBoolean(responseHeaders.get(Headers.IBM_SSE_KP_ENABLED)));
        	}
        	if (!StringUtils.isNullOrEmpty(responseHeaders.get(Headers.IBM_SSE_KP_CUSTOMER_ROOT_KEY_CRN))) {
        		((ObjectListing) result).setIBMSSEKPCrk(responseHeaders.get(Headers.IBM_SSE_KP_CUSTOMER_ROOT_KEY_CRN));
        	} 
        }
    }

    return awsResponse;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:26,代码来源:S3XmlResponseHandler.java


示例7: testHeadersAddedToObjectListing

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * Test the IBM_SSE_KP_ENABLED & IBM_SSE_KP_CRK are set in the ObjectLIsting
 * response object
 * @throws Exception 
 * 
 */	
@Test
public void testHeadersAddedToObjectListing() throws Exception {
	
	Unmarshaller<ObjectListing, InputStream> unmarshaller = new Unmarshallers.ListObjectsUnmarshaller(false);
	S3XmlResponseHandler xmlResponseHandler = new S3XmlResponseHandler<ObjectListing>(unmarshaller);
	HttpResponse httpResponse = new HttpResponse(null, null);
	httpResponse.addHeader(Headers.IBM_SSE_KP_ENABLED, "True");
	httpResponse.addHeader(Headers.IBM_SSE_KP_CUSTOMER_ROOT_KEY_CRN, "123456");

	InputStream is = new ByteArrayInputStream(getXmlContent().getBytes());;
	httpResponse.setContent(is);

	AmazonWebServiceResponse<ObjectListing> objectListing = xmlResponseHandler.handle(httpResponse);
	
	assertEquals(objectListing.getResult().getIBMSSEKPCrk(), "123456");
	assertEquals(objectListing.getResult().getIBMSSEKPEnabled(), true);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:24,代码来源:S3XmlResponseHandlerTest.java


示例8: testNullKPHeadersAreHandled

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * Test the IBM_SSE_KP_ENABLED & IBM_SSE_KP_CRK null headers are handled
 * 
 * @throws Exception 
 * 
 */	
@Test
public void testNullKPHeadersAreHandled() throws Exception {
	
	Unmarshaller<ObjectListing, InputStream> unmarshaller = new Unmarshallers.ListObjectsUnmarshaller(false);
	S3XmlResponseHandler xmlResponseHandler = new S3XmlResponseHandler<ObjectListing>(unmarshaller);
	HttpResponse httpResponse = new HttpResponse(null, null);
	httpResponse.addHeader(Headers.IBM_SSE_KP_ENABLED, null);
	httpResponse.addHeader(Headers.IBM_SSE_KP_CRK, null);

	InputStream is = new ByteArrayInputStream(getXmlContent().getBytes());;
	httpResponse.setContent(is);

	AmazonWebServiceResponse<ObjectListing> objectListing = xmlResponseHandler.handle(httpResponse);
	
	assertEquals(objectListing.getResult().getIBMSSEKPCrk(), null);
	assertEquals(objectListing.getResult().getIBMSSEKPEnabled(), false);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:24,代码来源:S3XmlResponseHandlerTest.java


示例9: testOnlyKPEnabledHeaderIsSet

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * Test the IBM_SSE_KP_CRK empty header is handled
 * 
 * @throws Exception 
 * 
 */	
@Test
public void testOnlyKPEnabledHeaderIsSet() throws Exception {
	
	Unmarshaller<ObjectListing, InputStream> unmarshaller = new Unmarshallers.ListObjectsUnmarshaller(false);
	S3XmlResponseHandler xmlResponseHandler = new S3XmlResponseHandler<ObjectListing>(unmarshaller);
	HttpResponse httpResponse = new HttpResponse(null, null);
	httpResponse.addHeader(Headers.IBM_SSE_KP_ENABLED, "True");

	InputStream is = new ByteArrayInputStream(getXmlContent().getBytes());;
	httpResponse.setContent(is);

	AmazonWebServiceResponse<ObjectListing> objectListing = xmlResponseHandler.handle(httpResponse);
	
	assertEquals(objectListing.getResult().getIBMSSEKPCrk(), null);
	assertEquals(objectListing.getResult().getIBMSSEKPEnabled(), true);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:23,代码来源:S3XmlResponseHandlerTest.java


示例10: testOnlyCRKHeaderIsSet

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * Test the IBM_SSE_KP_CRK empty header is handled
 * 
 * @throws Exception 
 * 
 */	
@Test
public void testOnlyCRKHeaderIsSet() throws Exception {
	
	Unmarshaller<ObjectListing, InputStream> unmarshaller = new Unmarshallers.ListObjectsUnmarshaller(false);
	S3XmlResponseHandler xmlResponseHandler = new S3XmlResponseHandler<ObjectListing>(unmarshaller);
	HttpResponse httpResponse = new HttpResponse(null, null);
	httpResponse.addHeader(Headers.IBM_SSE_KP_CUSTOMER_ROOT_KEY_CRN, "34567");

	InputStream is = new ByteArrayInputStream(getXmlContent().getBytes());;
	httpResponse.setContent(is);

	AmazonWebServiceResponse<ObjectListing> objectListing = xmlResponseHandler.handle(httpResponse);
	
	assertEquals(objectListing.getResult().getIBMSSEKPCrk(), "34567");
	assertEquals(objectListing.getResult().getIBMSSEKPEnabled(), false);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:23,代码来源:S3XmlResponseHandlerTest.java


示例11: testRestoreObjects

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
@Test
public void testRestoreObjects()
{
    // Put a 1 byte Glacier storage class file in S3.
    ObjectMetadata metadata = new ObjectMetadata();
    metadata.setHeader(Headers.STORAGE_CLASS, StorageClass.Glacier);
    metadata.setOngoingRestore(false);
    s3Operations
        .putObject(new PutObjectRequest(storageDaoTestHelper.getS3ManagedBucketName(), TARGET_S3_KEY, new ByteArrayInputStream(new byte[1]), metadata),
            null);

    // Initiate a restore request for the test S3 file.
    S3FileTransferRequestParamsDto params = new S3FileTransferRequestParamsDto();
    params.setS3BucketName(storageDaoTestHelper.getS3ManagedBucketName());
    params.setFiles(Arrays.asList(new File(TARGET_S3_KEY)));
    s3Dao.restoreObjects(params, S3_RESTORE_OBJECT_EXPIRATION_IN_DAYS);

    // Validate that there is an ongoing restore request for this object.
    ObjectMetadata objectMetadata = s3Operations.getObjectMetadata(storageDaoTestHelper.getS3ManagedBucketName(), TARGET_S3_KEY, null);
    assertTrue(objectMetadata.getOngoingRestore());
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:22,代码来源:S3DaoTest.java


示例12: testRestoreObjectsGlacierObjectAlreadyBeingRestored

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
@Test
public void testRestoreObjectsGlacierObjectAlreadyBeingRestored()
{
    // Put a 1 byte Glacier storage class file in S3 flagged as already being restored.
    ObjectMetadata metadata = new ObjectMetadata();
    metadata.setHeader(Headers.STORAGE_CLASS, StorageClass.Glacier);
    metadata.setOngoingRestore(true);
    s3Operations
        .putObject(new PutObjectRequest(storageDaoTestHelper.getS3ManagedBucketName(), TARGET_S3_KEY, new ByteArrayInputStream(new byte[1]), metadata),
            null);

    // Initiate a restore request for the test S3 file.
    S3FileTransferRequestParamsDto params = new S3FileTransferRequestParamsDto();
    params.setS3BucketName(storageDaoTestHelper.getS3ManagedBucketName());
    params.setFiles(Arrays.asList(new File(TARGET_S3_KEY)));
    s3Dao.restoreObjects(params, S3_RESTORE_OBJECT_EXPIRATION_IN_DAYS);

    // Validate that there is still an ongoing restore request for this object.
    ObjectMetadata objectMetadata = s3Operations.getObjectMetadata(storageDaoTestHelper.getS3ManagedBucketName(), TARGET_S3_KEY, null);
    assertTrue(objectMetadata.getOngoingRestore());
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:22,代码来源:S3DaoTest.java


示例13: testValidateGlacierS3FilesRestored

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
@Test
public void testValidateGlacierS3FilesRestored()
{
    // Put a 1 byte already restored Glacier storage class file in S3.
    ObjectMetadata metadata = new ObjectMetadata();
    metadata.setHeader(Headers.STORAGE_CLASS, StorageClass.Glacier);
    metadata.setOngoingRestore(false);
    s3Operations
        .putObject(new PutObjectRequest(storageDaoTestHelper.getS3ManagedBucketName(), TARGET_S3_KEY, new ByteArrayInputStream(new byte[1]), metadata),
            null);

    // Validate the file.
    S3FileTransferRequestParamsDto params = new S3FileTransferRequestParamsDto();
    params.setS3BucketName(storageDaoTestHelper.getS3ManagedBucketName());
    params.setFiles(Arrays.asList(new File(TARGET_S3_KEY)));
    s3Dao.validateGlacierS3FilesRestored(params);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:18,代码来源:S3DaoTest.java


示例14: testValidateGlacierS3FilesRestoredGlacierObjectRestoreNotInitiated

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
@Test
public void testValidateGlacierS3FilesRestoredGlacierObjectRestoreNotInitiated()
{
    // Put a 1 byte Glacier storage class file in S3 that has no restore initiated (OngoingRestore flag is null).
    ObjectMetadata metadata = new ObjectMetadata();
    metadata.setHeader(Headers.STORAGE_CLASS, StorageClass.Glacier);
    s3Operations
        .putObject(new PutObjectRequest(storageDaoTestHelper.getS3ManagedBucketName(), TARGET_S3_KEY, new ByteArrayInputStream(new byte[1]), metadata),
            null);

    // Try to validate if the Glacier S3 file is already restored.
    try
    {
        S3FileTransferRequestParamsDto params = new S3FileTransferRequestParamsDto();
        params.setS3BucketName(storageDaoTestHelper.getS3ManagedBucketName());
        params.setFiles(Arrays.asList(new File(TARGET_S3_KEY)));
        s3Dao.validateGlacierS3FilesRestored(params);
        fail("Should throw an IllegalArgumentException when Glacier S3 file is not restored.");
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String
            .format("Archived Glacier S3 file \"%s\" is not restored. StorageClass {GLACIER}, OngoingRestore flag {null}, S3 bucket name {%s}",
                TARGET_S3_KEY, storageDaoTestHelper.getS3ManagedBucketName()), e.getMessage());
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:27,代码来源:S3DaoTest.java


示例15: getMetaData

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
static Map<String, Object> getMetaData(S3Object s3Object) {
  Map<String, Object> metaDataMap = new HashMap<>();

  // put the metadata of S3 Object
  metaDataMap.put(Headers.CACHE_CONTROL, s3Object.getObjectMetadata().getCacheControl());
  metaDataMap.put(Headers.CONTENT_DISPOSITION, s3Object.getObjectMetadata().getContentDisposition());
  metaDataMap.put(Headers.CONTENT_ENCODING, s3Object.getObjectMetadata().getContentEncoding());
  metaDataMap.put(Headers.CONTENT_LENGTH, s3Object.getObjectMetadata().getContentLength());
  metaDataMap.put(Headers.CONTENT_RANGE, s3Object.getObjectMetadata().getInstanceLength());
  metaDataMap.put(Headers.CONTENT_MD5, s3Object.getObjectMetadata().getContentMD5());
  metaDataMap.put(Headers.CONTENT_TYPE, s3Object.getObjectMetadata().getContentType());
  metaDataMap.put(Headers.EXPIRES, s3Object.getObjectMetadata().getExpirationTime());
  metaDataMap.put(Headers.ETAG, s3Object.getObjectMetadata().getETag());
  metaDataMap.put(Headers.LAST_MODIFIED, s3Object.getObjectMetadata().getLastModified());

  // put user metadata
  Map<String, String> userMetaMap = s3Object.getObjectMetadata().getUserMetadata();
  if(userMetaMap != null) {
    for (Map.Entry<String, String> entry : userMetaMap.entrySet()) {
      if (entry.getValue() != null) {
        metaDataMap.put(entry.getKey(), entry.getValue());
      }
    }
  }
  return metaDataMap;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:27,代码来源:AmazonS3Util.java


示例16: getS3Metadata

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
private static Map<String, Object> getS3Metadata(S3Object s3Object) {
  Map<String, Object> metaDataMap = new HashMap<>();
  metaDataMap.put(Headers.CACHE_CONTROL, s3Object.getObjectMetadata().getCacheControl());
  metaDataMap.put(Headers.CONTENT_DISPOSITION, s3Object.getObjectMetadata().getContentDisposition());
  metaDataMap.put(Headers.CONTENT_ENCODING, s3Object.getObjectMetadata().getContentEncoding());
  metaDataMap.put(Headers.CONTENT_LENGTH, s3Object.getObjectMetadata().getContentLength());
  metaDataMap.put(Headers.CONTENT_RANGE, s3Object.getObjectMetadata().getInstanceLength());
  metaDataMap.put(Headers.CONTENT_MD5, s3Object.getObjectMetadata().getContentMD5());
  metaDataMap.put(Headers.CONTENT_TYPE, s3Object.getObjectMetadata().getContentType());
  metaDataMap.put(Headers.EXPIRES, s3Object.getObjectMetadata().getExpirationTime());
  metaDataMap.put(Headers.ETAG, s3Object.getObjectMetadata().getETag());
  metaDataMap.put(Headers.LAST_MODIFIED, s3Object.getObjectMetadata().getLastModified());
  metaDataMap.put("bucket", s3Object.getBucketName());
  metaDataMap.put("objectKey", s3Object.getKey());
  metaDataMap.put("size", s3Object.getObjectMetadata().getContentLength());
  return metaDataMap;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:18,代码来源:TestAmazonS3TargetForWholeFile.java


示例17: getInstanceLength

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * Returns the physical length of the entire object stored in S3.
 * This is useful during, for example, a range get operation.
 */
public long getInstanceLength() {
    // See Content-Range in
    // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
    String contentRange = (String)metadata.get(Headers.CONTENT_RANGE);
    if (contentRange != null) {
        int pos = contentRange.lastIndexOf("/");
        if (pos >= 0)
            return Long.parseLong(contentRange.substring(pos+1));
    }
    return getContentLength();
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:16,代码来源:ObjectMetadata.java


示例18: getStorageClass

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * @return The storage class of the object. Returns null if the object is in STANDARD storage.
 *         See {@link StorageClass} for possible values
 */
public String getStorageClass() {
    final Object storageClass = metadata.get(Headers.STORAGE_CLASS);
    if (storageClass == null) {
        return null;
    }
    return storageClass.toString();
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:12,代码来源:ObjectMetadata.java


示例19: handle

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
@Override
public void handle(T result, HttpResponse response) {
    String restoreHeader = response.getHeaders().get(Headers.RESTORE);
    if (restoreHeader != null) {
        result.setRestoreExpirationTime(parseDate(restoreHeader));
        Boolean onGoingRestore = parseBoolean(restoreHeader);
        if (onGoingRestore != null) {
            result.setOngoingRestore(onGoingRestore);
        }
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:12,代码来源:ObjectRestoreHeaderHandler.java


示例20: parseResponseMetadata

import com.amazonaws.services.s3.Headers; //导入依赖的package包/类
/**
 * Parses the S3 response metadata (ex: AWS request ID) from the specified
 * response, and returns a AmazonWebServiceResponse<T> object ready for the
 * result to be plugged in.
 *
 * @param response
 *            The response containing the response metadata to pull out.
 *
 * @return A new, populated AmazonWebServiceResponse<T> object, ready for
 *         the result to be plugged in.
 */
protected AmazonWebServiceResponse<T> parseResponseMetadata(HttpResponse response) {
    AmazonWebServiceResponse<T> awsResponse = new AmazonWebServiceResponse<T>();
    String awsRequestId = response.getHeaders().get(Headers.REQUEST_ID);
    String hostId = response.getHeaders().get(Headers.EXTENDED_REQUEST_ID);
    String cloudFrontId = response.getHeaders().get(Headers.CLOUD_FRONT_ID);

    Map<String, String> metadataMap = new HashMap<String, String>();
    metadataMap.put(ResponseMetadata.AWS_REQUEST_ID, awsRequestId);
    metadataMap.put(S3ResponseMetadata.HOST_ID, hostId);
    metadataMap.put(S3ResponseMetadata.CLOUD_FRONT_ID, cloudFrontId);
    awsResponse.setResponseMetadata(new S3ResponseMetadata(metadataMap));

    return awsResponse;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:26,代码来源:AbstractS3ResponseHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ValuePattern类代码示例发布时间:2022-05-23
下一篇:
Java FiberContextSwitchInterceptor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap