public class TwitterRESTService extends ConnectionRequest
ConnectionRequest.CachingMode, ConnectionRequest.SSLCertificate
Modifier and Type | Field and Description |
---|---|
static String |
METHOD_TWEETS |
static String |
METHOD_USER_TIMELINE |
PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_NORMAL, PRIORITY_REDUNDANT
Constructor and Description |
---|
TwitterRESTService(String method)
The constructor accepts the method to invoke
|
TwitterRESTService(String method,
boolean post)
The constructor accepts the method to invoke
|
TwitterRESTService(String method,
String version,
boolean post)
The constructor accepts the method to invoke
|
Modifier and Type | Method and Description |
---|---|
String |
getIdStr()
Gets the id string of the first entry which is important if we want to set the id
to start with in the next request
|
Hashtable<String,Object> |
getParseTree()
Returns the full Hashtable parse tree read from the server
|
Hashtable<String,Object> |
getStatus(int offset)
Returns the status at the given offset
|
int |
getStatusesCount()
Returns the number of statuses within the response
|
static String |
initToken(String consumerKey,
String consumerSecret)
Logs in to twitter as an application
|
protected void |
readResponse(InputStream input)
Callback for the server response with the input stream from the server.
|
static void |
setToken(String token)
For every request twitter now needs an authorization token
|
addArgument, addArgument, addArgument, addArgumentArray, addArgumentNoEncoding, addArgumentNoEncoding, addArgumentNoEncodingArray, addArguments, addExceptionListener, addRequestHeader, addResponseCodeListener, addResponseListener, buildRequestBody, cacheUnmodified, canGetSSLCertificates, checkSSLCertificates, cookieReceived, cookieSent, createRequestURL, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, equals, fetchJSON, fetchJSONAsync, fireResponseListener, getCachedData, getCacheMode, getContentLength, getContentType, getCookieHeader, getDefaultCacheMode, getDefaultUserAgent, getDestinationFile, getDestinationStorage, getDisposeOnCompletion, getHeader, getHeaderFieldNames, getHeaders, getHttpMethod, getPriority, getReadTimeout, getRequestBody, getRequestBodyData, getResponseCode, getResponseContentType, getResponseData, getResponseErrorMessage, getResposeCode, getShowOnInit, getSilentRetryCount, getSSLCertificates, getTimeout, getUrl, getUserAgent, getYield, handleErrorResponseCode, handleException, handleIOException, handleRuntimeException, hashCode, hasResponseListeners, initConnection, initCookieHeader, ioStreamUpdate, isCheckSSLCertificates, isCookiesEnabled, isCookiesEnabledDefault, isDefaultFollowRedirects, isDuplicateSupported, isFailSilently, isFollowRedirects, isHandleErrorCodesInGlobalErrorHandler, isInsecure, isKilled, isNativeCookieSharingSupported, isPausable, isPaused, isPost, isReadRequest, isReadResponseForErrors, isReadResponseForErrorsDefault, isReadTimeoutSupported, isRedirecting, isWriteRequest, kill, onRedirect, pause, postResponse, purgeCache, purgeCacheDirectory, readErrorCodeHeaders, readHeaders, removeAllArguments, removeArgument, removeExceptionListener, removeResponseCodeListener, removeResponseListener, resume, retry, setCacheMode, setCheckSSLCertificates, setChunkedStreamingMode, setContentType, setCookieHeader, setCookiesEnabled, setCookiesEnabledDefault, setDefaultCacheMode, setDefaultFollowRedirects, setDefaultUserAgent, setDestinationFile, setDestinationStorage, setDisposeOnCompletion, setDuplicateSupported, setFailSilently, setFollowRedirects, setHandleErrorCodesInGlobalErrorHandler, setHttpMethod, setInsecure, setKilled, setPaused, setPost, setPriority, setReadRequest, setReadResponseForErrors, setReadResponseForErrorsDefault, setReadTimeout, setRequestBody, setRequestBody, setShowOnInit, setSilentRetryCount, setTimeout, setUrl, setUseNativeCookieStore, setUserAgent, setWriteRequest, shouldAutoCloseResponse, shouldConvertPostToGetOnRedirect, shouldStop, shouldWriteUTFAsGetBytes, validate
public static final String METHOD_USER_TIMELINE
public static final String METHOD_TWEETS
public TwitterRESTService(String method)
method
- the api method to invoke e.g. "statuses/public_timeline"public TwitterRESTService(String method, boolean post)
method
- the api method to invoke e.g. "statuses/public_timeline"post
- true for post requests and false for get requestpublic TwitterRESTService(String method, String version, boolean post)
method
- the api method to invoke e.g. "statuses/public_timeline"version
- the API version to send e.g. "1"post
- true for post requests and false for get requestpublic static String initToken(String consumerKey, String consumerSecret)
consumerKey
- the key to login withconsumerSecret
- the secret to to login withpublic static void setToken(String token)
token
- the tokenprotected void readResponse(InputStream input) throws IOException
readResponse
in class ConnectionRequest
input
- the input stream containing the responseIOException
- when a read input occurspublic Hashtable<String,Object> getParseTree()
public int getStatusesCount()
public Hashtable<String,Object> getStatus(int offset)
offset
- the offset for the statuspublic String getIdStr()