Example #1
0
  protected <T> void processOnResponses(HttpMethod httpMethod, HttpInvocation<T> httpInvocation)
      throws Exception {
    int statusCode = httpMethod.getStatusCode();
    httpInvocation.onResponseStatus(statusCode);

    Header[] responseHeaders = httpMethod.getResponseHeaders();
    if (ArrayUtils.isNotEmpty(responseHeaders)) {
      for (Header header : responseHeaders) {
        httpInvocation.onResponseHeader(header.getName(), header.getValue());
      }
    }

    httpInvocation.onResponseBody(httpMethod.getResponseBodyAsStream());
  }