Package com.amazonaws.services.s3.internal

Examples of com.amazonaws.services.s3.internal.AWSS3V4Signer


        Signer signer = getSigner();

        if (upgradeToSigV4() && !(signer instanceof AWSS3V4Signer)){

            AWSS3V4Signer v4Signer = new AWSS3V4Signer();

            // Always set the service name; if the user has overridden it via
            // setEndpoint(String, String, String), this will return the right
            // value. Otherwise it will return "s3", which is an appropriate
            // default.
            v4Signer.setServiceName(getServiceNameIntern());

            // If the user has set an authentication region override, pass it
            // to the signer. Otherwise leave it null - the signer will parse
            // region from the request endpoint.

            String regionOverride = getSignerRegionOverride();
            if (regionOverride == null) {
                if (!hasExplicitRegion) {
                    throw new AmazonClientException(
                        "Signature Version 4 requires knowing the region of "
                        + "the bucket you're trying to access. You can "
                        + "configure a region by calling AmazonS3Client."
                        + "setRegion(Region) or AmazonS3Client.setEndpoint("
                        + "String) with a region-specific endpoint such as "
                        + "\"s3-us-west-2.amazonaws.com\".");
                }
            } else {
                v4Signer.setRegionName(regionOverride);
            }

            return v4Signer;

        }
View Full Code Here


        Signer signer = getSigner();

        if (upgradeToSigV4() && !(signer instanceof AWSS3V4Signer)){

            AWSS3V4Signer v4Signer = new AWSS3V4Signer();

            // Always set the service name; if the user has overridden it via
            // setEndpoint(String, String, String), this will return the right
            // value. Otherwise it will return "s3", which is an appropriate
            // default.
            v4Signer.setServiceName(getServiceNameIntern());

            // If the user has set an authentication region override, pass it
            // to the signer. Otherwise leave it null - the signer will parse
            // region from the request endpoint.

            String regionOverride = getSignerRegionOverride();
            if (regionOverride == null) {
                if (!hasExplicitRegion) {
                    throw new AmazonClientException(
                        "Signature Version 4 requires knowing the region of "
                        + "the bucket you're trying to access. You can "
                        + "configure a region by calling AmazonS3Client."
                        + "setRegion(Region) or AmazonS3Client.setEndpoint("
                        + "String) with a region-specific endpoint such as "
                        + "\"s3-us-west-2.amazonaws.com\".");
                }
            } else {
                v4Signer.setRegionName(regionOverride);
            }

            return v4Signer;

        }
View Full Code Here

        Signer signer = getSigner();

        if (upgradeToSigV4() && !(signer instanceof AWSS3V4Signer)){

            AWSS3V4Signer v4Signer = new AWSS3V4Signer();

            // Always set the service name; if the user has overridden it via
            // setEndpoint(String, String, String), this will return the right
            // value. Otherwise it will return "s3", which is an appropriate
            // default.
            v4Signer.setServiceName(getServiceNameIntern());

            // If the user has set an authentication region override, pass it
            // to the signer. Otherwise leave it null - the signer will parse
            // region from the request endpoint.

            String regionOverride = getSignerRegionOverride();
            if (regionOverride == null) {
                if (!hasExplicitRegion) {
                    throw new AmazonClientException(
                        "Signature Version 4 requires knowing the region of "
                        + "the bucket you're trying to access. You can "
                        + "configure a region by calling AmazonS3Client."
                        + "setRegion(Region) or AmazonS3Client.setEndpoint("
                        + "String) with a region-specific endpoint such as "
                        + "\"s3-us-west-2.amazonaws.com\".");
                }
            } else {
                v4Signer.setRegionName(regionOverride);
            }

            return v4Signer;

        }
View Full Code Here

        Signer signer = getSigner();

        if (upgradeToSigV4() && !(signer instanceof AWSS3V4Signer)){

            AWSS3V4Signer v4Signer = new AWSS3V4Signer();

            // Always set the service name; if the user has overridden it via
            // setEndpoint(String, String, String), this will return the right
            // value. Otherwise it will return "s3", which is an appropriate
            // default.
            v4Signer.setServiceName(getServiceNameIntern());

            // If the user has set an authentication region override, pass it
            // to the signer. Otherwise leave it null - the signer will parse
            // region from the request endpoint.

            String regionOverride = getSignerRegionOverride();
            if (regionOverride == null) {
                if (!hasExplicitRegion) {
                    throw new AmazonClientException(
                        "Signature Version 4 requires knowing the region of "
                        + "the bucket you're trying to access. You can "
                        + "configure a region by calling AmazonS3Client."
                        + "setRegion(Region) or AmazonS3Client.setEndpoint("
                        + "String) with a region-specific endpoint such as "
                        + "\"s3-us-west-2.amazonaws.com\".");
                }
            } else {
                v4Signer.setRegionName(regionOverride);
            }

            return v4Signer;

        }
View Full Code Here

                                  final String bucketName,
                                  final String key) {

        if (upgradeToSigV4()){
            if (v4Signer == null) {
                v4Signer = new AWSS3V4Signer();
                v4Signer.setServiceName(serviceName);
                v4Signer.setRegionName(regionName);
            }
            return v4Signer;
        }
View Full Code Here

                                  final String bucketName,
                                  final String key) {

        if (upgradeToSigV4()){
            if (v4Signer == null) {
                v4Signer = new AWSS3V4Signer();
                v4Signer.setServiceName(serviceName);
                v4Signer.setRegionName(regionName);
            }
            return v4Signer;
        }
View Full Code Here

                    partETags);

            uploadResult = getEndpoint().getS3Client().completeMultipartUpload(compRequest);

        } catch (Exception e) {
            getEndpoint().getS3Client().abortMultipartUpload(new AbortMultipartUploadRequest(
                    getConfiguration().getBucketName(), keyName, initResponse.getUploadId()));
            throw e;
        }

        Message message = getMessageForResponse(exchange);
View Full Code Here

        if (cannedAcl != null) {
            CannedAccessControlList objectAcl = CannedAccessControlList.valueOf(cannedAcl);
            initRequest.setCannedACL(objectAcl);
        }

        AccessControlList acl = exchange.getIn().getHeader(S3Constants.ACL, AccessControlList.class);
        if (acl != null) {
            // note: if cannedacl and acl are both specified the last one will be used. refer to
            // PutObjectRequest#setAccessControlList for more details
            initRequest.setAccessControlList(acl);
        }
View Full Code Here

        if (cannedAcl != null) {
            CannedAccessControlList objectAcl = CannedAccessControlList.valueOf(cannedAcl);
            putObjectRequest.setCannedAcl(objectAcl);
        }

        AccessControlList acl = exchange.getIn().getHeader(S3Constants.ACL, AccessControlList.class);
        if (acl != null) {
            // note: if cannedacl and acl are both specified the last one will be used. refer to
            // PutObjectRequest#setAccessControlList for more details
            putObjectRequest.setAccessControlList(acl);
        }
View Full Code Here

                    input.read(buffer, 0, (int) (partToRead - cur > buffer.length ? buffer.length : partToRead - cur));
                } catch (IOException ex) {
                    throw new ElasticsearchException("cannot read input stream", ex);
                }
            }
            AmazonS3Exception ex = new AmazonS3Exception("Random S3 exception");
            ex.setStatusCode(400);
            ex.setErrorCode("RequestTimeout");
            throw ex;
        } else {
            return super.putObject(bucketName, key, input, metadata);
        }
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.s3.internal.AWSS3V4Signer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.