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(); return new OptionsHttp11Response();
} }
List<RequestProtocolError> fatalError = requestCompliance.requestIsFatallyNonCompliant(request); HttpResponse fatalErrorResponse = getFatallyNoncompliantResponse(
request, context);
for (RequestProtocolError error : fatalError) { if (fatalErrorResponse != null) return fatalErrorResponse;
setResponseStatus(context, CacheResponseStatus.CACHE_MODULE_RESPONSE);
return requestCompliance.getErrorForRequest(error);
}
request = requestCompliance.makeRequestCompliant(request); request = requestCompliance.makeRequestCompliant(request);
request.addHeader("Via",via); request.addHeader("Via",via);
@ -453,6 +450,19 @@ public class CachingHttpClient implements HttpClient {
} }
} }
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, private Map<String, Variant> getExistingCacheVariants(HttpHost target,