|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.stackmob.sdk.callback.StackMobRawCallback
com.stackmob.sdk.callback.StackMobCallback
public abstract class StackMobCallback
The basic callback class for responding to asynchronous StackMob calls. Most methods in the StackMob
class take one of these as an argument. It's standard practice to subclass on the fly.
stackmob.doSomething(argument, new StackMobCallback() {
public void success(String responseBody) {
assertNotNull(responseBody);
latch.countDown();
}
public void failure(StackMobException e) {
fail(e.getMessage());
}
}
When a callback is invoked you will generally not be in the main thread, so react accordingly.
| Field Summary |
|---|
| Fields inherited from class com.stackmob.sdk.callback.StackMobRawCallback |
|---|
requestBody, requestHeaders, requestURL, requestVerb, responseBody, responseHeaders, responseStatusCode, retriesRemaining |
| Constructor Summary | |
|---|---|
StackMobCallback()
|
|
| Method Summary | |
|---|---|
void |
circularRedirect(String originalUrl,
Map<String,String> redirectHeaders,
String redirectBody,
String newURL)
Invoked when a circular redirect has been detected. |
void |
done(com.stackmob.sdk.net.HttpVerb requestVerb,
String requestURL,
List<Map.Entry<String,String>> requestHeaders,
String requestBody,
Integer responseStatusCode,
List<Map.Entry<String,String>> responseHeaders,
byte[] responseBody)
the method that will be called when the call to StackMob is complete. |
abstract void |
failure(StackMobException e)
override this method to handle errors |
abstract void |
success(String responseBody)
override this method to handles cases where a call has succeeded. |
void |
temporaryPasswordResetRequired(StackMobException e)
the method that will be called in the very specific case where a user has done a login with a temporary password, and now they need to reset their password to continue. |
void |
unsent(StackMobException e)
the method that will be called when a call to StackMob cannot even be sent for some reason |
| Methods inherited from class com.stackmob.sdk.callback.StackMobRawCallback |
|---|
getRetriesRemaining, getTotalNumberOfItemsFromContentRange, getTotalObjectCountFromPagination, redirected, retry, setDone, setRetriesRemaining |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StackMobCallback()
| Method Detail |
|---|
public void unsent(StackMobException e)
StackMobRawCallback
unsent in class StackMobRawCallbacke - an error with the reason whypublic void temporaryPasswordResetRequired(StackMobException e)
StackMobRawCallbackStackMobUser.loginResettingTemporaryPassword(String, StackMobCallback)
with the new password
temporaryPasswordResetRequired in class StackMobRawCallbacke - an error with the reason why
public void circularRedirect(String originalUrl,
Map<String,String> redirectHeaders,
String redirectBody,
String newURL)
StackMobRawCallback
circularRedirect in class StackMobRawCallbackoriginalUrl - the url being redirected fromredirectHeaders - headers that came with the redirectredirectBody - the body that came with the redirectnewURL - the url being redirected to
public void done(com.stackmob.sdk.net.HttpVerb requestVerb,
String requestURL,
List<Map.Entry<String,String>> requestHeaders,
String requestBody,
Integer responseStatusCode,
List<Map.Entry<String,String>> responseHeaders,
byte[] responseBody)
StackMobRawCallback
done in class StackMobRawCallbackrequestVerb - the HTTP verb that was requestedrequestURL - the URL that was requestedrequestHeaders - the headers in the requestrequestBody - the body of the request. will be an empty string for GET, DELETE, etc...responseStatusCode - the status code of the HTTP response from StackMobresponseHeaders - the response headers from StackMobresponseBody - the response body from StackMobpublic abstract void success(String responseBody)
responseBody - the response string received from StackMobpublic abstract void failure(StackMobException e)
e - a representation of the error that occurred
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||