• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java BucketCrossOriginConfiguration类的典型用法和代码示例

java 2次浏览

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

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

示例1: getBucketCrossOriginConfiguration

点赞 3

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public BucketCrossOriginConfiguration getBucketCrossOriginConfiguration(GetBucketCrossOriginConfigurationRequest getBucketCrossOriginConfigurationRequest) {
    getBucketCrossOriginConfigurationRequest = beforeClientExecution(getBucketCrossOriginConfigurationRequest);
    rejectNull(getBucketCrossOriginConfigurationRequest, "The request object parameter getBucketCrossOriginConfigurationRequest must be specified.");
    String bucketName = getBucketCrossOriginConfigurationRequest.getBucketName();
    rejectNull(bucketName, "The bucket name must be specified when retrieving the bucket cross origin configuration.");

    Request<GetBucketCrossOriginConfigurationRequest> request = createRequest(bucketName, null, getBucketCrossOriginConfigurationRequest, HttpMethodName.GET);
    request.addParameter("cors", null);

    try {
        return invoke(request, new Unmarshallers.BucketCrossOriginConfigurationUnmarshaller(), bucketName, null);
    } catch (AmazonServiceException ase) {
        switch (ase.getStatusCode()) {
        case 404:
            return null;
        default:
            throw ase;
        }
    }
}
 

开发者ID:IBM,
项目名称:ibm-cos-sdk-java
代码行数:22,
代码来源:AmazonS3Client.java

示例2: convertToXmlByteArray

点赞 3

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
/**
 * Converts the specified {@link BucketCrossOriginConfiguration} object to an XML fragment that
 * can be sent to Amazon S3.
 *
 * @param config
 *            The {@link BucketCrossOriginConfiguration}
 */
/*
 * <CORSConfiguration>
         <CORSRule>
           <AllowedOrigin>http://www.foobar.com</AllowedOrigin>
           <AllowedMethod>GET</AllowedMethod>
           <MaxAgeSeconds>3000</MaxAgeSec>
           <ExposeHeader>x-amz-server-side-encryption</ExposeHeader>
         </CORSRule>
   </CORSConfiguration>
 */
public byte[] convertToXmlByteArray(BucketCrossOriginConfiguration config) throws SdkClientException {

    XmlWriter xml = new XmlWriter();
    xml.start("CORSConfiguration", "xmlns", Constants.XML_NAMESPACE);

    for (CORSRule rule : config.getRules()) {
        writeRule(xml, rule);
    }

    xml.end();

    return xml.getBytes();
}
 

开发者ID:IBM,
项目名称:ibm-cos-sdk-java
代码行数:31,
代码来源:BucketConfigurationXmlFactory.java

示例3: setBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public void setBucketCrossOriginConfiguration(
        SetBucketCrossOriginConfigurationRequest setBucketCrossOriginConfigurationRequest) {
    setBucketCrossOriginConfigurationRequest = beforeClientExecution(setBucketCrossOriginConfigurationRequest);
    rejectNull(setBucketCrossOriginConfigurationRequest,
            "The set bucket cross origin configuration request object must be specified.");

    String bucketName = setBucketCrossOriginConfigurationRequest.getBucketName();
    BucketCrossOriginConfiguration bucketCrossOriginConfiguration = setBucketCrossOriginConfigurationRequest.getCrossOriginConfiguration();

    rejectNull(bucketName,
            "The bucket name parameter must be specified when setting bucket cross origin configuration.");
    rejectNull(bucketCrossOriginConfiguration,
            "The cross origin configuration parameter must be specified when setting bucket cross origin configuration.");

    Request<SetBucketCrossOriginConfigurationRequest> request = createRequest(bucketName, null, setBucketCrossOriginConfigurationRequest, HttpMethodName.PUT);
    request.addParameter("cors", null);

    byte[] content = new BucketConfigurationXmlFactory().convertToXmlByteArray(bucketCrossOriginConfiguration);
    request.addHeader("Content-Length", String.valueOf(content.length));
    request.addHeader("Content-Type", "application/xml");
    request.setContent(new ByteArrayInputStream(content));
    try {
        byte[] md5 = Md5Utils.computeMD5Hash(content);
        String md5Base64 = BinaryUtils.toBase64(md5);
        request.addHeader("Content-MD5", md5Base64);
    } catch ( Exception e ) {
        throw new SdkClientException("Couldn't compute md5 sum", e);
    }

    invoke(request, voidResponseHandler, bucketName, null);
}
 

开发者ID:IBM,
项目名称:ibm-cos-sdk-java
代码行数:33,
代码来源:AmazonS3Client.java

示例4: getBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public BucketCrossOriginConfiguration getBucketCrossOriginConfiguration(String bucketName) {
    return delegate.getBucketCrossOriginConfiguration(bucketName);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:AmazonS3Wrapper.java

示例5: setBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public void setBucketCrossOriginConfiguration(String bucketName, BucketCrossOriginConfiguration bucketCrossOriginConfiguration) {
    delegate.setBucketCrossOriginConfiguration(bucketName, bucketCrossOriginConfiguration);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:AmazonS3Wrapper.java

示例6: getBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public BucketCrossOriginConfiguration getBucketCrossOriginConfiguration(String bucketName) {
  return call(() -> getDelegate().getBucketCrossOriginConfiguration(bucketName));
}
 

开发者ID:HubSpot,
项目名称:S3Decorators,
代码行数:5,
代码来源:S3Decorator.java

示例7: setBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public void setBucketCrossOriginConfiguration(String bucketName, BucketCrossOriginConfiguration bucketCrossOriginConfiguration) {
  run(() -> getDelegate().setBucketCrossOriginConfiguration(bucketName, bucketCrossOriginConfiguration));
}
 

开发者ID:HubSpot,
项目名称:S3Decorators,
代码行数:5,
代码来源:S3Decorator.java

示例8: getBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public BucketCrossOriginConfiguration getBucketCrossOriginConfiguration(String bucketName)
{
    return null;
}
 

开发者ID:y-lan,
项目名称:presto,
代码行数:6,
代码来源:MockAmazonS3.java

示例9: setBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public void setBucketCrossOriginConfiguration(String bucketName, BucketCrossOriginConfiguration bucketCrossOriginConfiguration)
{
}
 

开发者ID:y-lan,
项目名称:presto,
代码行数:5,
代码来源:MockAmazonS3.java

示例10: getBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public BucketCrossOriginConfiguration getBucketCrossOriginConfiguration(String bucketName) {
  // TODO Auto-generated method stub
  return null;
}
 

开发者ID:DemandCube,
项目名称:Scribengin,
代码行数:6,
代码来源:AmazonS3Mock.java

示例11: setBucketCrossOriginConfiguration

点赞 2

import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; //导入依赖的package包/类
@Override
public void setBucketCrossOriginConfiguration(String bucketName,
    BucketCrossOriginConfiguration bucketCrossOriginConfiguration) {
  // TODO Auto-generated method stub

}
 

开发者ID:DemandCube,
项目名称:Scribengin,
代码行数:7,
代码来源:AmazonS3Mock.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)