com.stackmob.sdk.callback
Class StackMobBinaryCallback

java.lang.Object
  extended by com.stackmob.sdk.callback.StackMobRawCallback
      extended by com.stackmob.sdk.callback.StackMobBinaryCallback

public abstract class StackMobBinaryCallback
extends StackMobRawCallback

A callback class that allows access to the raw byte array of the response body. This is helpful when the body is binary payload such as a generic String or image.


Field Summary
 
Fields inherited from class com.stackmob.sdk.callback.StackMobRawCallback
requestBody, requestHeaders, requestURL, requestVerb, responseBody, responseHeaders, responseStatusCode, retriesRemaining
 
Constructor Summary
StackMobBinaryCallback()
           
 
Method Summary
 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(byte[] 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, retry, setDone, setRetriesRemaining
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackMobBinaryCallback

public StackMobBinaryCallback()
Method Detail

unsent

public void unsent(StackMobException e)
Description copied from class: StackMobRawCallback
the method that will be called when a call to StackMob cannot even be sent for some reason

Specified by:
unsent in class StackMobRawCallback
Parameters:
e - an error with the reason why

temporaryPasswordResetRequired

public void temporaryPasswordResetRequired(StackMobException e)
Description copied from class: StackMobRawCallback
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. Respond to this by putting up a reset password screen and then calling StackMobUser.loginResettingTemporaryPassword(String, StackMobCallback) with the new password

Specified by:
temporaryPasswordResetRequired in class StackMobRawCallback
Parameters:
e - an error with the reason why

done

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)
Description copied from class: StackMobRawCallback
the method that will be called when the call to StackMob is complete. may be executed in a background thread

Specified by:
done in class StackMobRawCallback
Parameters:
requestVerb - the HTTP verb that was requested
requestURL - the URL that was requested
requestHeaders - the headers in the request
requestBody - the body of the request. will be an empty string for GET, DELETE, etc...
responseStatusCode - the status code of the HTTP response from StackMob
responseHeaders - the response headers from StackMob
responseBody - the response body from StackMob

success

public abstract void success(byte[] responseBody)
override this method to handles cases where a call has succeeded.

Parameters:
responseBody - the response binary received from StackMob

failure

public abstract void failure(StackMobException e)
override this method to handle errors

Parameters:
e - a representation of the error that occurred


Copyright © 2013 StackMob. All Rights Reserved.