Skip to content

Commit cdc3762

Browse files
committed
AsyncHttpClient: added setMaxRetries method;
fixed a type;
1 parent 4b6eb97 commit cdc3762

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/com/loopj/android/http/AsyncHttpClient.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public void setUserAgent(String userAgent) {
218218
}
219219

220220
/**
221-
* Sets the connection time oout. By default, 10 seconds
221+
* Sets the connection timeout. By default, 10 seconds
222222
* @param timeout the connect/socket timeout in milliseconds
223223
*/
224224
public void setTimeout(int timeout){
@@ -236,7 +236,15 @@ public void setTimeout(int timeout){
236236
public void setSSLSocketFactory(SSLSocketFactory sslSocketFactory) {
237237
this.httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("https", sslSocketFactory, 443));
238238
}
239-
239+
240+
/**
241+
* Sets the maximum number of retries for a particular Request.
242+
* @param retries maximum number of retries per request
243+
*/
244+
public void setMaxRetries(int retries) {
245+
this.httpClient.setHttpRequestRetryHandler(new RetryHandler(retries));
246+
}
247+
240248
/**
241249
* Sets headers that will be added to all requests this client makes (before sending).
242250
* @param header the name of the header

0 commit comments

Comments
 (0)