/** * We've received all the error content so send it off to the error response handler to produce the service exception. */ private AmazonServiceException unmarshallError() throws Exception { errorResponse.setContent(new ByteArrayInputStream(BinaryUtils.copyBytesFrom(cumulation.nioBuffer()))); return errorResponseHandler.handle(errorResponse); }
/** * Creates and initializes an HttpResponse object suitable to be passed to an HTTP response * handler object. * * @param request Marshalled request object. * @param method The HTTP method that was invoked to get the response. * @param context The HTTP context associated with the request and response. * @return The new, initialized HttpResponse object ready to be passed to an HTTP response * handler object. * @throws IOException If there were any problems getting any response information from the * HttpClient method object. */ public static HttpResponse createResponse(Request<?> request, HttpRequestBase method, org.apache.http.HttpResponse apacheHttpResponse, HttpContext context) throws IOException { HttpResponse httpResponse = new HttpResponse(request, method, context); if (apacheHttpResponse.getEntity() != null) { httpResponse.setContent(apacheHttpResponse.getEntity().getContent()); } httpResponse.setStatusCode(apacheHttpResponse.getStatusLine().getStatusCode()); httpResponse.setStatusText(apacheHttpResponse.getStatusLine().getReasonPhrase()); for (Header header : apacheHttpResponse.getAllHeaders()) { httpResponse.addHeader(header.getName(), header.getValue()); } return httpResponse; }
if (System.getProperty(PROFILING_SYSTEM_PROPERTY) != null) { is = countingInputStream = new CountingInputStream(is); httpResponse.setContent(is); httpResponse.setContent(ProgressInputStream.inputStreamForResponse(is, listener));
/** * Creates and initializes an HttpResponse object suitable to be passed to an HTTP response * handler object. * * @param request Marshalled request object. * @param method The HTTP method that was invoked to get the response. * @param context The HTTP context associated with the request and response. * @return The new, initialized HttpResponse object ready to be passed to an HTTP response * handler object. * @throws IOException If there were any problems getting any response information from the * HttpClient method object. */ public static HttpResponse createResponse(Request<?> request, HttpRequestBase method, org.apache.http.HttpResponse apacheHttpResponse, HttpContext context) throws IOException { HttpResponse httpResponse = new HttpResponse(request, method, context); if (apacheHttpResponse.getEntity() != null) { httpResponse.setContent(apacheHttpResponse.getEntity().getContent()); } httpResponse.setStatusCode(apacheHttpResponse.getStatusLine().getStatusCode()); httpResponse.setStatusText(apacheHttpResponse.getStatusLine().getReasonPhrase()); for (Header header : apacheHttpResponse.getAllHeaders()) { httpResponse.addHeader(header.getName(), header.getValue()); } return httpResponse; }
if (System.getProperty(PROFILING_SYSTEM_PROPERTY) != null) { is = countingInputStream = new CountingInputStream(is); httpResponse.setContent(is); httpResponse.setContent(ProgressInputStream.inputStreamForResponse(is, listener));
/** * We've received all the error content so send it off to the error response handler to produce the service exception. */ private AmazonServiceException unmarshallError() throws Exception { errorResponse.setContent(new ByteArrayInputStream(BinaryUtils.copyBytesFrom(cumulation.nioBuffer()))); return errorResponseHandler.handle(errorResponse); }
/** * Creates and initializes an HttpResponse object suitable to be passed to an HTTP response * handler object. * * @param method The HTTP method that was invoked to get the response. * @param context The HTTP context associated with the request and response. * @return The new, initialized HttpResponse object ready to be passed to an HTTP response * handler object. * @throws IOException If there were any problems getting any response information from the * HttpClient method object. */ private HttpResponse createResponse(HttpRequestBase method, org.apache.http.HttpResponse apacheHttpResponse, HttpContext context) throws IOException { HttpResponse httpResponse = new HttpResponse(request, method, context); if (apacheHttpResponse.getEntity() != null) { httpResponse.setContent(apacheHttpResponse.getEntity().getContent()); } httpResponse.setStatusCode(apacheHttpResponse.getStatusLine().getStatusCode()); httpResponse.setStatusText(apacheHttpResponse.getStatusLine().getReasonPhrase()); for (Header header : apacheHttpResponse.getAllHeaders()) { httpResponse.addHeader(header.getName(), header.getValue()); } return httpResponse; }
@Benchmark public Object getItem(GetItemState s) { HttpResponse resp = new HttpResponse(null, null); resp.setContent(new ByteArrayInputStream(s.testItem.utf8())); try { return getItemJsonResponseHandler().handle(resp); } catch (Exception e) { throw new RuntimeException(e); } }
if (System.getProperty(PROFILING_SYSTEM_PROPERTY) != null) { is = countingInputStream = new CountingInputStream(is); httpResponse.setContent(is); httpResponse.setContent(ProgressInputStream.inputStreamForResponse(is, listener));