diff options
Diffstat (limited to 'src/main/java/com/android/volley/Request.java')
-rw-r--r-- | src/main/java/com/android/volley/Request.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/com/android/volley/Request.java b/src/main/java/com/android/volley/Request.java index 5b42d1f..8200f6e 100644 --- a/src/main/java/com/android/volley/Request.java +++ b/src/main/java/com/android/volley/Request.java @@ -20,7 +20,6 @@ import android.net.TrafficStats; import android.net.Uri; import android.os.Handler; import android.os.Looper; -import android.os.SystemClock; import android.text.TextUtils; import com.android.volley.VolleyLog.MarkerLog; @@ -90,6 +89,9 @@ public abstract class Request<T> implements Comparable<Request<T>> { /** Whether or not a response has been delivered for this request yet. */ private boolean mResponseDelivered = false; + /** Whether the request should be retried in the event of an HTTP 5xx (server) error. */ + private boolean mShouldRetryServerErrors = false; + /** The retry policy for this request. */ private RetryPolicy mRetryPolicy; @@ -474,6 +476,23 @@ public abstract class Request<T> implements Comparable<Request<T>> { } /** + * Sets whether or not the request should be retried in the event of an HTTP 5xx (server) error. + * + * @return This Request object to allow for chaining. + */ + public final Request<?> setShouldRetryServerErrors(boolean shouldRetryServerErrors) { + mShouldRetryServerErrors = shouldRetryServerErrors; + return this; + } + + /** + * Returns true if this request should be retried in the event of an HTTP 5xx (server) error. + */ + public final boolean shouldRetryServerErrors() { + return mShouldRetryServerErrors; + } + + /** * Priority values. Requests will be processed from higher priorities to * lower priorities, in FIFO order. */ |