T - The type of the parsed object. You can say, this is the result of
http requestpublic class HttpResponse<T> extends Object
| Constructor and Description |
|---|
HttpResponse() |
HttpResponse(HttpRequest request,
int httpStatusCode,
T parsedResult) |
HttpResponse(int httpStatusCode,
T parsedResult) |
| Modifier and Type | Method and Description |
|---|---|
long |
getExpirationTimestamp()
Get the timestamp in utc timezone, when the value of this response
expires
|
HttpRequest |
getHttpRequest()
Get the
HttpRequest that has been processed to generate this
HttpResponse |
int |
getResponseCode()
Get the http status code of the http response
|
T |
getValue()
Get the parsed Result
|
boolean |
isFromCache()
Returns true, if the response has been retrieved from the cache
|
boolean |
isFromCacheBecauseOffline() |
boolean |
isResponseOkOrNotModified()
Checks if the response status code of the http request was 200 or 304,
which means that the http request has returned successful or the result
has been retrieved successfully from the cache
|
void |
setExpirationTimestamp(long utcTimestamp)
Set the timestamp when the value of this response expires
|
void |
setFromCache(boolean fromCache) |
void |
setFromCacheBecauseOffline(boolean smartphoneIsOffline)
Set this to true, if the response comes from the cache, because the
smartphone is offline
|
void |
setHttpRequest(HttpRequest httpRequest) |
void |
setResonseCode(int statusCode)
Set the status code of the http response
|
void |
setValue(T parsedResult)
Set the parsed Result of the http response
|
String |
toString() |
public HttpResponse()
public HttpResponse(int httpStatusCode,
T parsedResult)
public HttpResponse(HttpRequest request, int httpStatusCode, T parsedResult)
public void setResonseCode(int statusCode)
statusCode - public void setValue(T parsedResult)
parsedResult - public int getResponseCode()
public T getValue()
public boolean isResponseOkOrNotModified()
public void setFromCache(boolean fromCache)
public boolean isFromCache()
public boolean isFromCacheBecauseOffline()
public void setFromCacheBecauseOffline(boolean smartphoneIsOffline)
smartphoneIsOffline - public HttpRequest getHttpRequest()
HttpRequest that has been processed to generate this
HttpResponsepublic void setHttpRequest(HttpRequest httpRequest)
httpRequest - getHttpRequest()public void setExpirationTimestamp(long utcTimestamp)
utcTimestamp - in millisecondspublic long getExpirationTimestamp()
Copyright © 2015 Hannes Dorfmann. All rights reserved.