@Override public void handle(Request request, Response response) { try { ClientCall clientCall = getAdapter().toSpecific(this, request); getAdapter().commit(clientCall, request, response); } catch (Exception e) { getLogger().log(Level.INFO, "Error while handling an HTTP client call", e); response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, e); } }
public void handle(Request request, Response response) { try { updateResponse(response, new Status(httpCall.getStatusCode(), httpCall.getReasonPhrase()), httpCall); if (userCallback != null) { userCallback.handle(request, response); } } catch (Throwable t) { getLogger() .log(Level.WARNING, "Unexpected error or exception inside the user call back", t); } } });
/** * Reads the response headers of a handled HTTP client call to update the * original uniform call. * * @param httpCall * The handled HTTP client call. * @param response * The high-level response to update. */ protected void readResponseHeaders(ClientCall httpCall, Response response) { try { Series<Header> responseHeaders = httpCall.getResponseHeaders(); // Put the response headers in the call's attributes map response.getAttributes().put(HeaderConstants.ATTRIBUTE_HEADERS, responseHeaders); HeaderUtils.copyResponseTransportHeaders(responseHeaders, response); } catch (Exception e) { getLogger() .log(Level.FINE, "An error occurred during the processing of the HTTP response.", e); response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, e); } }
.println("HTTP client calls must have a callback in the GWT edition"); } else { updateResponse(response, httpCall.sendRequest(request), httpCall);
readResponseHeaders(httpCall, response);