public void commit(final ClientCall httpCall, Request request,
Response response) throws Exception {
if (httpCall != null) {
// Check if the call is asynchronous
if (request.getOnResponse() != null) {
final Uniform userCallback = request.getOnResponse();
// Send the request to the client
httpCall.sendRequest(request, response, new Uniform() {
public void handle(Request request, Response response) {
try {
updateResponse(response,
new Status(httpCall.getStatusCode(), null,
httpCall.getReasonPhrase(), null),
httpCall);
userCallback.handle(request, response);
} catch (Exception e) {
// Unexpected exception occurred
if ((response.getStatus() == null)
|| !response.getStatus().isError()) {
response.setStatus(
Status.CONNECTOR_ERROR_INTERNAL, e);
userCallback.handle(request, response);
}
}
}
});
} else {