return op.getRequest();
}
public void handleResponse(final HttpResponse response,
final HttpContext context) {
RequestHandle handle =
(RequestHandle) context.removeAttribute("request-handle");
HttpOperation op = (HttpOperation) context.removeAttribute("operation");
try {
response.setEntity(new BufferedHttpEntity(response.getEntity()));
} catch(IOException ex) {
throw new RuntimeException("Could not convert HttpEntity content.");
}
int statusCode = response.getStatusLine().getStatusCode();
if (handle != null) {
boolean shouldRetry = shouldRetry(statusCode, response);
if(shouldRetry) {
if(!op.isTimedOut() && !op.isCancelled()) {
getLogger().info("Retrying HTTP operation Request: "
+ op.getRequest().getRequestLine() + ", Response: "
+ response.getStatusLine());
vconn.addOp(op);
}
} else {
op.handleResponse(response);
}
handle.completed();
}
}