hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r755395 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
Date Tue, 17 Mar 2009 21:04:08 GMT
Author: olegk
Date: Tue Mar 17 21:04:07 2009
New Revision: 755395

URL: http://svn.apache.org/viewvc?rev=755395&view=rev
Log:
Automatically retry methods considered idempotent

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java?rev=755395&r1=755394&r2=755395&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
Tue Mar 17 21:04:07 2009
@@ -38,6 +38,8 @@
 
 import javax.net.ssl.SSLHandshakeException;
 
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpRequest;
 import org.apache.http.NoHttpResponseException;
 import org.apache.http.client.HttpRequestRetryHandler;
 import org.apache.http.protocol.HttpContext;
@@ -110,9 +112,19 @@
             // SSL handshake exception
             return false;
         }
+        
+        HttpRequest request = (HttpRequest)
+            context.getAttribute(ExecutionContext.HTTP_REQUEST);
+        boolean idempotent = !(request instanceof HttpEntityEnclosingRequest); 
+        if (idempotent) {
+            // Retry if the request is considered idempotent 
+            return true;
+        }
+        
         Boolean b = (Boolean)
             context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
         boolean sent = (b != null && b.booleanValue());
+        
         if (!sent || this.requestSentRetryEnabled) {
             // Retry if the request has not been sent fully or
             // if it's OK to retry methods that have been sent



Mime
View raw message