List of usage examples for com.amazonaws.http HttpResponse getContent
public InputStream getContent()
From source file:com.emc.vipr.services.s3.ViPRS3Client.java
License:Open Source License
public GetFileAccessResult getFileAccess(GetFileAccessRequest getFileAccessRequest) throws AmazonClientException { assertParameterNotNull(getFileAccessRequest, "The GetFileAccessRequest parameter must be specified"); String bucketName = getFileAccessRequest.getBucketName(); assertParameterNotNull(bucketName, "The bucket name parameter must be specified when querying file access"); Request<GetFileAccessRequest> request = createRequest(bucketName, null, getFileAccessRequest, HttpMethodName.GET);/*from w w w. j a va 2 s . c o m*/ request.addParameter(ViPRConstants.FILE_ACCESS_PARAMETER, null); if (getFileAccessRequest.getMarker() != null) { request.addParameter(ViPRConstants.MARKER_PARAMETER, getFileAccessRequest.getMarker()); } if (getFileAccessRequest.getMaxKeys() > 0) { // TODO: is this an appropriate indicator? request.addParameter(ViPRConstants.MAX_KEYS_PARAMETER, Long.toString(getFileAccessRequest.getMaxKeys())); } return invoke(request, new AbstractS3ResponseHandler<GetFileAccessResult>() { public AmazonWebServiceResponse<GetFileAccessResult> handle(HttpResponse response) throws Exception { log.trace("Beginning to parse fileaccess response XML"); GetFileAccessResult result = new GetFileAccessResultUnmarshaller() .unmarshall(response.getContent()); log.trace("Done parsing fileaccess response XML"); AmazonWebServiceResponse<GetFileAccessResult> awsResponse = parseResponseMetadata(response); awsResponse.setResult(result); return awsResponse; } }, bucketName, null); }
From source file:com.emc.vipr.services.s3.ViPRS3Client.java
License:Open Source License
public ListDataNodesResult listDataNodes(ListDataNodesRequest listDataNodesRequest) throws AmazonClientException { Request<ListDataNodesRequest> request = createRequest(null, null, listDataNodesRequest, HttpMethodName.GET); request.addParameter(ViPRConstants.ENDPOINT_PARAMETER, null); return invoke(request, new AbstractS3ResponseHandler<ListDataNodesResult>() { public AmazonWebServiceResponse<ListDataNodesResult> handle(HttpResponse response) throws Exception { log.trace("Beginning to parse endpoint response XML"); ListDataNodesResult result = new ListDataNodesResultUnmarshaller() .unmarshall(response.getContent()); log.trace("Done parsing endpoint response XML"); AmazonWebServiceResponse<ListDataNodesResult> awsResponse = parseResponseMetadata(response); awsResponse.setResult(result); return awsResponse; }//w ww.j a v a 2 s. co m }, null, null); }
From source file:com.ivona.services.tts.model.transform.createspeech.CreateSpeechResultUnmarshaller.java
License:Open Source License
@Override public CreateSpeechResult unmarshall(HttpResponse response) { String requestId = response.getHeaders().get(HEADER_AMZN_REQUEST_ID); String ttsRequestId = response.getHeaders().get(HEADER_IVONA_TTS_REQUEST_ID); String contentType = response.getHeaders().get(HEADER_CONTENT_TYPE); int requestCharacters = Integer.parseInt(response.getHeaders().get(HEADER_TTS_REQUEST_CHARACTERS)); int requestUnits = Integer.parseInt(response.getHeaders().get(HEADER_TTS_REQUEST_UNITS)); CreateSpeechResult createSpeechResult = new CreateSpeechResult(); createSpeechResult.setRequestId(requestId); createSpeechResult.setTtsRequestId(ttsRequestId); createSpeechResult.setContentType(contentType); createSpeechResult.setTtsRequestCharacters(requestCharacters); createSpeechResult.setTtsRequestUnits(requestUnits); createSpeechResult.setBody(response.getContent()); return createSpeechResult; }