public static class BoxRequest.BoxRequestHandler<R extends BoxRequest>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_NUM_RETRIES |
protected static int |
DEFAULT_RATE_LIMIT_WAIT |
protected int |
mNumRateLimitRetries |
protected R |
mRequest |
static java.lang.String |
OAUTH_ERROR_HEADER |
static java.lang.String |
OAUTH_INVALID_TOKEN |
static java.lang.String |
WWW_AUTHENTICATE |
| Constructor and Description |
|---|
BoxRequestHandler(R request) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
disconnectForInterrupt(BoxHttpResponse response) |
protected static int |
getRetryAfterFromResponse(BoxHttpResponse response,
int defaultSeconds) |
boolean |
isResponseSuccess(BoxHttpResponse response)
Check the response returned from the server.
|
boolean |
onException(BoxRequest request,
BoxHttpResponse response,
BoxException ex) |
<T extends BoxObject> |
onResponse(java.lang.Class<T> clazz,
BoxHttpResponse response)
Parse the response from the server into the expected object T.
|
protected <T extends BoxObject> |
retryRateLimited(BoxHttpResponse response) |
public static final java.lang.String OAUTH_ERROR_HEADER
public static final java.lang.String OAUTH_INVALID_TOKEN
public static final java.lang.String WWW_AUTHENTICATE
protected static final int DEFAULT_NUM_RETRIES
protected static final int DEFAULT_RATE_LIMIT_WAIT
protected R extends BoxRequest mRequest
protected int mNumRateLimitRetries
public BoxRequestHandler(R request)
public boolean isResponseSuccess(BoxHttpResponse response)
response - the response from the server.public <T extends BoxObject> T onResponse(java.lang.Class<T> clazz, BoxHttpResponse response) throws java.lang.IllegalAccessException, java.lang.InstantiationException, BoxException
T - the class to return an instance of.clazz - the class to use to construct an instance of T in which to parse data to.response - the response from the server.java.lang.IllegalAccessException - thrown if clazz this class does not have access to the constructor for clazz.java.lang.InstantiationException - thrown if clazz cannot be instantiated for example if it does not have a default contsructor.BoxException - thrown for any type of server exception or server response indicating an error.protected <T extends BoxObject> T retryRateLimited(BoxHttpResponse response) throws BoxException
BoxExceptionprotected void disconnectForInterrupt(BoxHttpResponse response) throws BoxException
BoxExceptionpublic boolean onException(BoxRequest request, BoxHttpResponse response, BoxException ex) throws BoxException.RefreshFailure
request - The request that has failed.response - the response from sending the request.ex - The exception thrown from sending the failed request.BoxException.RefreshFailure - thrown when request cannot be retried due to a bad access token that cannoth be refreshed.protected static int getRetryAfterFromResponse(BoxHttpResponse response, int defaultSeconds)