HTTPCLIENT-975: more method extraction from the body of

CachingHttpClient#execute()


git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1051087 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Moore 2010-12-20 12:51:26 +00:00
parent cd263f39e3
commit 65cb252c9b
1 changed files with 17 additions and 7 deletions

View File

@ -383,12 +383,9 @@ public class CachingHttpClient implements HttpClient {
return new OptionsHttp11Response();
}
List<RequestProtocolError> fatalError = requestCompliance.requestIsFatallyNonCompliant(request);
for (RequestProtocolError error : fatalError) {
setResponseStatus(context, CacheResponseStatus.CACHE_MODULE_RESPONSE);
return requestCompliance.getErrorForRequest(error);
}
HttpResponse fatalErrorResponse = getFatallyNoncompliantResponse(
request, context);
if (fatalErrorResponse != null) return fatalErrorResponse;
request = requestCompliance.makeRequestCompliant(request);
request.addHeader("Via",via);
@ -452,7 +449,20 @@ public class CachingHttpClient implements HttpClient {
throw new ClientProtocolException(e);
}
}
return callBackend(target, request, context);
return callBackend(target, request, context);
}
private HttpResponse getFatallyNoncompliantResponse(HttpRequest request,
HttpContext context) {
HttpResponse fatalErrorResponse = null;
List<RequestProtocolError> fatalError = requestCompliance.requestIsFatallyNonCompliant(request);
for (RequestProtocolError error : fatalError) {
setResponseStatus(context, CacheResponseStatus.CACHE_MODULE_RESPONSE);
fatalErrorResponse = requestCompliance.getErrorForRequest(error);
}
return fatalErrorResponse;
}
private Map<String, Variant> getExistingCacheVariants(HttpHost target,