Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2010-2015, Inc. or its affiliates. All Rights Reserved.
  * Licensed under the Apache License, Version 2.0 (the "License").
  * You may not use this file except in compliance with the License.
  * A copy of the License is located at
 * or in the "license" file accompanying this file. This file is distributed
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
S3 HTTP response handler that knows how to pull S3 object content and metadata out of an HTTP response and unmarshall it into an S3Object object.
public class S3ObjectResponseHandler extends AbstractS3ResponseHandler<S3Object> {

    public AmazonWebServiceResponse<S3Objecthandle(HttpResponse responsethrows Exception {
         * TODO: It'd be nice to set the bucket name and key here, but the
         *       information isn't easy to pull out of the response/request
         *       currently.
        S3Object object = new S3Object();
        AmazonWebServiceResponse<S3ObjectawsResponse = parseResponseMetadata(response);
        if (response.getHeaders().get(.) != null) {
        // If the requester is charged when downloading a object from an
        // Requester Pays bucket, then this header is set.
        if (response.getHeaders().get(.) != null) {
        ObjectMetadata metadata = object.getObjectMetadata();
		return awsResponse;

Returns true, since the entire response isn't read while this response handler handles the response. This enables us to keep the underlying HTTP connection open, so that the caller can stream it off.

    public boolean needsConnectionLeftOpen() {
        return true;
New to GrepCode? Check out our FAQ X