org.apache.commons.httpclient

Class DefaultHttpMethodRetryHandler

Implemented Interfaces:
HttpMethodRetryHandler

public class DefaultHttpMethodRetryHandler
extends Object
implements HttpMethodRetryHandler

The default HttpMethodRetryHandler used by HttpMethods.

Constructor Summary

DefaultHttpMethodRetryHandler()
Creates a new DefaultHttpMethodRetryHandler that retries up to 3 times but does not retry methods that have successfully sent their requests.
DefaultHttpMethodRetryHandler(int retryCount, boolean requestSentRetryEnabled)
Creates a new DefaultHttpMethodRetryHandler.

Method Summary

int
getRetryCount()
boolean
isRequestSentRetryEnabled()
boolean
retryMethod(HttpMethod method, IOException exception, int executionCount)
Used retryCount and requestSentRetryEnabled to determine if the given method should be retried.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

DefaultHttpMethodRetryHandler

public DefaultHttpMethodRetryHandler()
Creates a new DefaultHttpMethodRetryHandler that retries up to 3 times but does not retry methods that have successfully sent their requests.
Usages and Demos :

View More Examples of DefaultHttpMethodRetryHandler()
   1:         params.setContentCharset("ISO-8859-1");
   2:         params.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler());
   3:         
   4:         ArrayList datePatterns = new ArrayList();
   5:         datePatterns.addAll(

View Full Code Here

DefaultHttpMethodRetryHandler

public DefaultHttpMethodRetryHandler(int retryCount,
                                     boolean requestSentRetryEnabled)
Creates a new DefaultHttpMethodRetryHandler.
Parameters:
retryCount - the number of times a method will be retried
requestSentRetryEnabled - if true, methods that have successfully sent their request will be retried
Usages and Demos :

View More Examples of DefaultHttpMethodRetryHandler(int retryCount,boolean requestSentRetryEnabled)
   1:         method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, 
   2:                 new DefaultHttpMethodRetryHandler(3, false));
   3:         try {
   4:             int statusCode = client.executeMethod(method);
   5:             if (statusCode != HttpStatus.SC_OK) {

View Full Code Here
   1:             httpClient.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, 
   2:                 new DefaultHttpMethodRetryHandler( 1, false ) );
   3:             
   4:             httpClient.getParams().setSoTimeout( 10000 );
   5:             httpClient.getHttpConnectionManager().getParams().setConnectionTimeout( 5000 );

View Full Code Here
   1:         client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, 
   2:             new DefaultHttpMethodRetryHandler( 0, false ) );
   3:         if (   ServiceManager.sCfg.isHttpProxyUsed 
   4:             && !StringUtils.isEmpty(ServiceManager.sCfg.httpProxyHost ) )
   5:         {

View Full Code Here

Method Details

getRetryCount

public int getRetryCount()
Returns:
the maximum number of times a method will be retried

isRequestSentRetryEnabled

public boolean isRequestSentRetryEnabled()
Returns:
true if this handler will retry methods that have successfully sent their request, false otherwise

retryMethod

public boolean retryMethod(HttpMethod method,
                           IOException exception,
                           int executionCount)
Used retryCount and requestSentRetryEnabled to determine if the given method should be retried.
Specified by:
retryMethod in interface HttpMethodRetryHandler