Return-Path: Delivered-To: apmail-jakarta-httpclient-commits-archive@www.apache.org Received: (qmail 52960 invoked from network); 9 Jun 2005 19:46:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Jun 2005 19:46:40 -0000 Received: (qmail 26902 invoked by uid 500); 9 Jun 2005 19:46:39 -0000 Mailing-List: contact httpclient-commits-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: httpclient-dev@jakarta.apache.org Delivered-To: mailing list httpclient-commits@jakarta.apache.org Received: (qmail 26889 invoked by uid 500); 9 Jun 2005 19:46:39 -0000 Delivered-To: apmail-jakarta-httpclient-cvs@jakarta.apache.org Received: (qmail 26886 invoked by uid 99); 9 Jun 2005 19:46:38 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 09 Jun 2005 12:46:37 -0700 Received: (qmail 52652 invoked by uid 65534); 9 Jun 2005 19:45:25 -0000 Message-ID: <20050609194525.52650.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r189802 - in /jakarta/httpclient/trunk/http-common/src: contrib/org/apache/http/contrib/spring/http-beans.xml java/org/apache/http/executor/HttpExecutionContext.java java/org/apache/http/executor/HttpRequestExecutor.java java/org/apache/http/impl/DefaultHttpRequestRetryHandler.java Date: Thu, 09 Jun 2005 19:45:24 -0000 To: httpclient-cvs@jakarta.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: olegk Date: Thu Jun 9 12:45:22 2005 New Revision: 189802 URL: http://svn.apache.org/viewcvs?rev=3D189802&view=3Drev Log: Added default request retry handler Added: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/Defa= ultHttpRequestRetryHandler.java - copied, changed from r189566, jakarta/commons/proper/httpclient/tru= nk/src/java/org/apache/commons/httpclient/DefaultHttpMethodRetryHandler.java Modified: jakarta/httpclient/trunk/http-common/src/contrib/org/apache/http/contri= b/spring/http-beans.xml jakarta/httpclient/trunk/http-common/src/java/org/apache/http/executor/= HttpExecutionContext.java jakarta/httpclient/trunk/http-common/src/java/org/apache/http/executor/= HttpRequestExecutor.java Modified: jakarta/httpclient/trunk/http-common/src/contrib/org/apache/http/= contrib/spring/http-beans.xml URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src= /contrib/org/apache/http/contrib/spring/http-beans.xml?rev=3D189802&r1=3D18= 9801&r2=3D189802&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/httpclient/trunk/http-common/src/contrib/org/apache/http/contri= b/spring/http-beans.xml (original) +++ jakarta/httpclient/trunk/http-common/src/contrib/org/apache/http/contri= b/spring/http-beans.xml Thu Jun 9 12:45:22 2005 @@ -24,6 +24,12 @@ 80 =20 + + 3 + false + + =20 @@ -38,6 +44,7 @@ + <= /property> =20 Oleg Kalnichevski + * @author Oleg Kalnichevski */ -public class DefaultHttpMethodRetryHandler implements HttpMethodRetryHandl= er { - +public class DefaultHttpRequestRetryHandler implements HttpRequestRetryHan= dler { =20 - private static Class SSL_HANDSHAKE_EXCEPTION =3D null; -=09 - static { - try { - SSL_HANDSHAKE_EXCEPTION =3D Class.forName("javax.net.ssl.SSLHandshakeEx= ception"); - } catch (ClassNotFoundException ignore) { =09 - } - } /** the number of times a method will be retried */ private int retryCount; =20 @@ -59,7 +57,7 @@ /** * Default constructor */ - public DefaultHttpMethodRetryHandler(int retryCount, boolean requestSe= ntRetryEnabled) { + public DefaultHttpRequestRetryHandler(int retryCount, boolean requestS= entRetryEnabled) { super(); this.retryCount =3D retryCount; this.requestSentRetryEnabled =3D requestSentRetryEnabled; @@ -68,7 +66,7 @@ /** * Default constructor */ - public DefaultHttpMethodRetryHandler() { + public DefaultHttpRequestRetryHandler() { this(3, false); } /**=20 @@ -77,16 +75,16 @@ *=20 * @see HttpMethodRetryHandler#retryMethod(HttpMethod, IOException, in= t) */ - public boolean retryMethod( - final HttpMethod method,=20 - final IOException exception,=20 - int executionCount) { - if (method =3D=3D null) { - throw new IllegalArgumentException("HTTP method may not be nul= l"); - } + public boolean retryRequest( + final IOException exception,=20 + int executionCount, + final HttpContext context) { if (exception =3D=3D null) { throw new IllegalArgumentException("Exception parameter may no= t be null"); } + if (context =3D=3D null) { + throw new IllegalArgumentException("HTTP context may not be nu= ll"); + } if (executionCount > this.retryCount) { // Do not retry if over max retry count return false; @@ -103,11 +101,13 @@ // Unknown host return false; } - if (SSL_HANDSHAKE_EXCEPTION !=3D null && SSL_HANDSHAKE_EXCEPTION.i= sInstance(exception)) { + if (exception instanceof SSLHandshakeException) { // SSL handshake exception return false; } - if (!method.isRequestSent() || this.requestSentRetryEnabled) { + Boolean b =3D (Boolean) context.getAttribute(HttpExecutionContext.= HTTP_REQ_SENT); + boolean sent =3D (b !=3D 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 return true;