hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1051087 - /httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
Date Mon, 20 Dec 2010 12:51:27 GMT
Author: jonm
Date: Mon Dec 20 12:51:26 2010
New Revision: 1051087

URL: http://svn.apache.org/viewvc?rev=1051087&view=rev
Log:
HTTPCLIENT-975: more method extraction from the body of
CachingHttpClient#execute()

Modified:
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java?rev=1051087&r1=1051086&r2=1051087&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpClient.java
Mon Dec 20 12:51:26 2010
@@ -383,12 +383,9 @@ public class CachingHttpClient implement
             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 implement
                 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,



Mime
View raw message