com.stackmob.sdk.api
Class StackMobRequest

java.lang.Object
  extended by com.stackmob.sdk.api.StackMobRequest
Direct Known Subclasses:
StackMobAccessTokenRequest, StackMobRequestWithoutPayload, StackMobRequestWithPayload, StackMobUserBasedRequest

public abstract class StackMobRequest
extends Object


Field Summary
protected static String API_KEY_HEADER
           
protected static String AUTHORIZATION_HEADER
           
protected  StackMobRawCallback callback
           
static String DEFAULT_API_URL_FORMAT
           
static String DEFAULT_PUSH_URL_FORMAT
           
static int DEFAULT_RETRY_AFTER_MILLIS
           
static String DEFAULT_URL_FORMAT
           
static List<Map.Entry<String,String>> EmptyHeaders
           
static Map<String,String> EmptyParams
           
protected  ExecutorService executor
           
protected  com.google.gson.Gson gson
           
protected  List<Map.Entry<String,String>> headers
           
protected  HttpVerb httpVerb
           
protected  Boolean isSecure
           
protected  String methodName
           
protected  Map<String,String> params
           
protected  StackMobRedirectedCallback redirectedCallback
           
protected static String REGULAR_SCHEME
           
protected static String SECURE_SCHEME
           
protected  StackMobSession session
           
protected  String urlFormat
           
 
Constructor Summary
protected StackMobRequest(ExecutorService executor, StackMobSession session, HttpVerb verb, List<Map.Entry<String,String>> headers, Map<String,String> params, String method, StackMobRawCallback cb, StackMobRedirectedCallback redirCb)
           
 
Method Summary
protected  URI createURI(String scheme, String host, String path, String query)
           
protected static String formatQueryString(Map<String,String> params)
           
protected  String getContentType()
           
static StackMobCookieStore getCookieStore()
           
protected  org.scribe.model.OAuthRequest getOAuthRequest(HttpVerb method, String url)
           
protected  org.scribe.model.OAuthRequest getOAuthRequest(HttpVerb method, String url, String payload)
           
protected  StackMob.OAuthVersion getOAuthVersion()
           
protected  String getPath()
           
protected abstract  String getRequestBody()
           
protected static List<Map.Entry<String,String>> getRequestHeaders(org.scribe.model.OAuthRequest req)
           
protected static HttpVerb getRequestVerb(org.scribe.model.OAuthRequest req)
           
protected  String getScheme()
           
protected static String percentEncode(String s)
           
protected  void refreshTokenAndResend()
           
protected  void sendDeleteRequest()
           
protected  void sendGetRequest()
           
protected  void sendPostRequest()
           
protected  void sendPutRequest()
           
 StackMobRequestSendResult sendRequest()
           
protected  void sendRequest(org.scribe.model.OAuthRequest req)
           
static void setCookieStore(StackMobCookieStore store)
           
 StackMobRequest setUrlFormat(String urlFmt)
           
protected  boolean tryRefreshToken()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EmptyHeaders

public static final List<Map.Entry<String,String>> EmptyHeaders

EmptyParams

public static final Map<String,String> EmptyParams

DEFAULT_RETRY_AFTER_MILLIS

public static final int DEFAULT_RETRY_AFTER_MILLIS
See Also:
Constant Field Values

DEFAULT_URL_FORMAT

public static final String DEFAULT_URL_FORMAT
See Also:
Constant Field Values

DEFAULT_API_URL_FORMAT

public static final String DEFAULT_API_URL_FORMAT
See Also:
Constant Field Values

DEFAULT_PUSH_URL_FORMAT

public static final String DEFAULT_PUSH_URL_FORMAT
See Also:
Constant Field Values

SECURE_SCHEME

protected static final String SECURE_SCHEME
See Also:
Constant Field Values

REGULAR_SCHEME

protected static final String REGULAR_SCHEME
See Also:
Constant Field Values

API_KEY_HEADER

protected static final String API_KEY_HEADER
See Also:
Constant Field Values

AUTHORIZATION_HEADER

protected static final String AUTHORIZATION_HEADER
See Also:
Constant Field Values

executor

protected final ExecutorService executor

session

protected final StackMobSession session

callback

protected StackMobRawCallback callback

redirectedCallback

protected final StackMobRedirectedCallback redirectedCallback

httpVerb

protected HttpVerb httpVerb

methodName

protected String methodName

urlFormat

protected String urlFormat

isSecure

protected Boolean isSecure

params

protected Map<String,String> params

headers

protected List<Map.Entry<String,String>> headers

gson

protected com.google.gson.Gson gson
Constructor Detail

StackMobRequest

protected StackMobRequest(ExecutorService executor,
                          StackMobSession session,
                          HttpVerb verb,
                          List<Map.Entry<String,String>> headers,
                          Map<String,String> params,
                          String method,
                          StackMobRawCallback cb,
                          StackMobRedirectedCallback redirCb)
Method Detail

setCookieStore

public static void setCookieStore(StackMobCookieStore store)

getCookieStore

public static StackMobCookieStore getCookieStore()

setUrlFormat

public StackMobRequest setUrlFormat(String urlFmt)

getRequestBody

protected abstract String getRequestBody()

sendRequest

public StackMobRequestSendResult sendRequest()

sendGetRequest

protected void sendGetRequest()
                       throws StackMobException
Throws:
StackMobException

sendPostRequest

protected void sendPostRequest()
                        throws StackMobException
Throws:
StackMobException

sendPutRequest

protected void sendPutRequest()
                       throws StackMobException
Throws:
StackMobException

sendDeleteRequest

protected void sendDeleteRequest()
                          throws StackMobException
Throws:
StackMobException

createURI

protected URI createURI(String scheme,
                        String host,
                        String path,
                        String query)
                 throws URISyntaxException
Throws:
URISyntaxException

getPath

protected String getPath()

getScheme

protected String getScheme()

percentEncode

protected static String percentEncode(String s)
                               throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

formatQueryString

protected static String formatQueryString(Map<String,String> params)

getContentType

protected String getContentType()

getOAuthVersion

protected StackMob.OAuthVersion getOAuthVersion()

getOAuthRequest

protected org.scribe.model.OAuthRequest getOAuthRequest(HttpVerb method,
                                                        String url)

getOAuthRequest

protected org.scribe.model.OAuthRequest getOAuthRequest(HttpVerb method,
                                                        String url,
                                                        String payload)

getRequestVerb

protected static HttpVerb getRequestVerb(org.scribe.model.OAuthRequest req)

getRequestHeaders

protected static List<Map.Entry<String,String>> getRequestHeaders(org.scribe.model.OAuthRequest req)

tryRefreshToken

protected boolean tryRefreshToken()

refreshTokenAndResend

protected void refreshTokenAndResend()

sendRequest

protected void sendRequest(org.scribe.model.OAuthRequest req)
                    throws InterruptedException,
                           ExecutionException
Throws:
InterruptedException
ExecutionException


Copyright © 2012 StackMob. All Rights Reserved.