public AmazonWebServiceResponse<String> handle(HttpResponse response) throws Exception { AmazonWebServiceResponse<String> awsResponse = parseResponseMetadata(response); int bytesRead; byte[] buffer = new byte[1024]; StringBuilder builder = new StringBuilder(); InputStream content = response.getContent(); while ((bytesRead = content.read(buffer)) > 0) { builder.append(new String(buffer, 0, bytesRead, StringUtils.UTF8)); } awsResponse.setResult(builder.toString()); return awsResponse; }
/** * @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); } return awsResponse; }
/** * @see com.amazonaws.http.HttpResponseHandler#handle(com.amazonaws.http.HttpResponse) */ public AmazonWebServiceResponse<ObjectMetadata> handle(HttpResponse response) throws Exception { ObjectMetadata metadata = new ObjectMetadata(); populateObjectMetadata(response, metadata); AmazonWebServiceResponse<ObjectMetadata> awsResponse = parseResponseMetadata(response); awsResponse.setResult(metadata); return awsResponse; }
@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)); awsResponse.setResult(result); return awsResponse; } }
awsResponse.setResult(result);
/** * @see com.amazonaws.http.HttpResponseHandler#handle(com.amazonaws.http.HttpResponse) */ public AmazonWebServiceResponse<S3Object> handle(HttpResponse response) throws 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<S3Object> awsResponse = parseResponseMetadata(response); if (response.getHeaders().get(Headers.REDIRECT_LOCATION) != null) { object.setRedirectLocation(response.getHeaders().get(Headers.REDIRECT_LOCATION)); } // If the requester is charged when downloading a object from an // Requester Pays bucket, then this header is set. if (response.getHeaders().get(Headers.REQUESTER_CHARGED_HEADER) != null) { object.setRequesterCharged(true); } if (response.getHeaders().get(Headers.S3_TAGGING_COUNT) != null) { object.setTaggingCount(Integer.parseInt(response.getHeaders().get(Headers.S3_TAGGING_COUNT))); } ObjectMetadata metadata = object.getObjectMetadata(); populateObjectMetadata(response, metadata); object.setObjectContent(new S3ObjectInputStream(response.getContent(), response.getHttpRequest())); awsResponse.setResult(object); return awsResponse; }
awsResponse.setResult(result);
@Override public AmazonWebServiceResponse<String> handle(HttpResponse response) throws Exception { AmazonWebServiceResponse<String> awsResponse = parseResponseMetadata(response); int bytesRead; byte[] buffer = new byte[DEFAULT_BYTE_SIZE]; StringBuilder builder = new StringBuilder(); InputStream content = response.getContent(); while ((bytesRead = content.read(buffer)) > 0) { builder.append(new String(buffer, 0, bytesRead, StringUtils.UTF8)); } awsResponse.setResult(builder.toString()); return awsResponse; }
@Override public AmazonWebServiceResponse<String> handle(HttpResponse response) throws Exception { AmazonWebServiceResponse<String> awsResponse = new AmazonWebServiceResponse<String>(); awsResponse.setResult("Result"); return awsResponse; }
@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)); awsResponse.setResult(result); return awsResponse; } }
/** * @see com.amazonaws.http.HttpResponseHandler#handle(com.amazonaws.http.HttpResponse) */ @Override public AmazonWebServiceResponse<ObjectMetadata> handle(HttpResponse response) throws Exception { ObjectMetadata metadata = new ObjectMetadata(); populateObjectMetadata(response, metadata); AmazonWebServiceResponse<ObjectMetadata> awsResponse = parseResponseMetadata(response); awsResponse.setResult(metadata); return awsResponse; }
/** * @see com.amazonaws.http.HttpResponseHandler#handle(com.amazonaws.http.HttpResponse) */ @Override 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); } return awsResponse; }
@Override public AmazonWebServiceResponse<String> handle(HttpResponse response) throws Exception { assertSame(response, httpResponse); AmazonWebServiceResponse<String> awsResponse = new AmazonWebServiceResponse<String>(); awsResponse.setResult("Result"); return awsResponse; }
awsResponse.setResult(result);
awsResponse.setResult(result);
awsResponse.setResult(result);
/** * @see com.amazonaws.http.HttpResponseHandler#handle(com.amazonaws.http.HttpResponse) */ @Override public AmazonWebServiceResponse<S3Object> handle(HttpResponse response) throws 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. */ final S3Object object = new S3Object(); final AmazonWebServiceResponse<S3Object> awsResponse = parseResponseMetadata(response); if (response.getHeaders().get(Headers.REDIRECT_LOCATION) != null) { object.setRedirectLocation(response.getHeaders().get(Headers.REDIRECT_LOCATION)); } // If the requester is charged when downloading a object from an // Requester Pays bucket, then this header is set. if (response.getHeaders().get(Headers.REQUESTER_CHARGED_HEADER) != null) { object.setRequesterCharged(true); } if (response.getHeaders().get(Headers.S3_TAGGING_COUNT) != null) { object.setTaggingCount(Integer.parseInt(response.getHeaders().get(Headers.S3_TAGGING_COUNT))); } final ObjectMetadata metadata = object.getObjectMetadata(); populateObjectMetadata(response, metadata); object.setObjectContent(new S3ObjectInputStream(response.getContent())); awsResponse.setResult(object); return awsResponse; }
awsResponse.setResult(result);
@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)); awsResponse.setResult(result); return awsResponse; } }
/** * @see com.amazonaws.http.HttpResponseHandler#handle(com.amazonaws.http.HttpResponse) */ @Override public AmazonWebServiceResponse<ObjectMetadata> handle(HttpResponse response) throws Exception { ObjectMetadata metadata = new ObjectMetadata(); populateObjectMetadata(response, metadata); AmazonWebServiceResponse<ObjectMetadata> awsResponse = parseResponseMetadata(response); awsResponse.setResult(metadata); return awsResponse; }