|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sponsorpay.sdk.android.publisher.AsyncRequest
public class AsyncRequest
Requests and loads a resource using the HTTP GET method in the background. Will call the
AsyncRequest.ResultListener
registered in the constructor in the same thread which
triggered the request / loading process. Uses the Android AsyncTask
mechanism.
Nested Class Summary | |
---|---|
static interface |
AsyncRequest.ResultListener
|
Field Summary | |
---|---|
static java.lang.String |
LOG_TAG
|
private java.lang.String[] |
mCookieStrings
Cookies returned by the server. |
private java.lang.Exception |
mRequestException
Stores an exception triggered when launching the request, usually caused by network connectivity problem. |
private java.lang.String |
mRequestUrl
URL for the request that will be performed in the background. |
private java.lang.String |
mResponseBody
Server's response body. |
private AsyncRequest.ResultListener |
mResultListener
Registered AsyncRequest.ResultListener to be notified of the request's results when they become
available. |
private int |
mStatusCode
Status code of the server's response. |
private static java.lang.String |
USER_AGENT_HEADER_NAME
Key of the User-Agent header sent on background requests. |
private static java.lang.String |
USER_AGENT_HEADER_VALUE
Value of the User-Agent header sent on background requests. |
Constructor Summary | |
---|---|
AsyncRequest(java.lang.String requestUrl,
AsyncRequest.ResultListener listener)
|
Method Summary | |
---|---|
boolean |
didRequestTriggerException()
Returns whether a local exception was triggered when trying to send the request. |
protected java.lang.Void |
doInBackground(java.lang.Void... params)
Performs the request in the background. |
java.lang.String[] |
getCookieStrings()
Gets the cookie strings returned by the server. |
int |
getHttpStatusCode()
Gets the returned HTTP status code. |
java.lang.Exception |
getRequestTriggeredException()
Returns the local exception triggered when trying to send the request. |
java.lang.String |
getResponseBody()
Gets the response body returned by the server. |
boolean |
hasSucessfulStatusCode()
Returns whether a successful HTTP status code was returned. |
protected void |
onPostExecute(java.lang.Void result)
Called in the original thread when a response from the server is available. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String LOG_TAG
private static java.lang.String USER_AGENT_HEADER_NAME
private static java.lang.String USER_AGENT_HEADER_VALUE
private java.lang.String mRequestUrl
private int mStatusCode
private java.lang.String mResponseBody
private java.lang.String[] mCookieStrings
private AsyncRequest.ResultListener mResultListener
AsyncRequest.ResultListener
to be notified of the request's results when they become
available.
private java.lang.Exception mRequestException
Constructor Detail |
---|
public AsyncRequest(java.lang.String requestUrl, AsyncRequest.ResultListener listener)
requestUrl
- URL to send the backgorund request to.listener
- AsyncRequest.ResultListener
to be notified of the request's results when they become
available.Method Detail |
---|
protected java.lang.Void doInBackground(java.lang.Void... params)
AsyncTask
when
#execute(Void...)
is invoked.
-
protected void onPostExecute(java.lang.Void result)
result
- public java.lang.String[] getCookieStrings()
public java.lang.String getResponseBody()
public int getHttpStatusCode()
public boolean didRequestTriggerException()
getRequestTriggeredException()
is recommended.
public java.lang.Exception getRequestTriggeredException()
public boolean hasSucessfulStatusCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |