abstract class TwitterOAuthSupportBase extends TwitterBase implements twitter4j.internal.http.HttpResponseCode, twitter4j.internal.http.HttpResponseListener, OAuthSupport, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected twitter4j.internal.http.HttpClientWrapper |
http |
protected RateLimitStatusListener |
rateLimitStatusListener |
private static long |
serialVersionUID |
auth, conf
Constructor and Description |
---|
TwitterOAuthSupportBase(Configuration conf) |
TwitterOAuthSupportBase(Configuration conf,
Authorization auth) |
TwitterOAuthSupportBase(Configuration conf,
java.lang.String screenName,
java.lang.String password) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
abstract AccessToken |
getOAuthAccessToken()
Returns an access token associated with this instance.
If no access token is associated with this instance, this will retrieve a new access token. |
abstract AccessToken |
getOAuthAccessToken(RequestToken requestToken)
Retrieves an access token associated with the supplied request token and sets userId.
|
abstract AccessToken |
getOAuthAccessToken(RequestToken requestToken,
java.lang.String oauthVerifier)
Retrieves an access token associated with the supplied request token and sets userId.
|
abstract AccessToken |
getOAuthAccessToken(java.lang.String oauthVerifier)
Retrieves an access token.
|
abstract AccessToken |
getOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret)
Retrieves an access token associated with the supplied screen name and password using xAuth.
In order to get access acquire AccessToken using xAuth, you must apply by sending an email to api@twitter.com — all other applications will receive an HTTP 401 error. |
abstract AccessToken |
getOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret,
java.lang.String pin)
Deprecated.
|
abstract RequestToken |
getOAuthRequestToken()
Retrieves a request token
|
abstract RequestToken |
getOAuthRequestToken(java.lang.String callbackUrl)
Retrieves a request token
|
int |
hashCode() |
void |
httpResponseReceived(twitter4j.internal.http.HttpResponseEvent event) |
private void |
init() |
boolean |
isOAuthEnabled()
tests if the instance is authenticated by Basic
|
private void |
readObject(java.io.ObjectInputStream stream) |
abstract void |
setOAuthAccessToken(AccessToken accessToken)
Sets the access token
|
abstract void |
setOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret)
Deprecated.
|
abstract void |
setOAuthConsumer(java.lang.String consumerKey,
java.lang.String consumerSecret)
sets the OAuth consumer key and consumer secret
|
void |
setRateLimitStatusListener(RateLimitStatusListener listener)
Registers a RateLimitStatusListener for account associated rate limits
|
void |
shutdown()
Free resources associated with this instance,
should be called on all instances constructed.
|
private void |
writeObject(java.io.ObjectOutputStream out) |
ensureAuthorizationEnabled, ensureOAuthEnabled, getAuthorization, getConfiguration, isBasicAuthEnabled, toString
protected transient twitter4j.internal.http.HttpClientWrapper http
protected RateLimitStatusListener rateLimitStatusListener
private static final long serialVersionUID
TwitterOAuthSupportBase(Configuration conf)
TwitterOAuthSupportBase(Configuration conf, java.lang.String screenName, java.lang.String password)
TwitterOAuthSupportBase(Configuration conf, Authorization auth)
private void init()
public void shutdown()
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public abstract void setOAuthConsumer(java.lang.String consumerKey, java.lang.String consumerSecret)
consumerKey
- OAuth consumer keyconsumerSecret
- OAuth consumer secretjava.lang.IllegalStateException
- when OAuth consumer has already been set, or the instance is using basic authorizationpublic abstract RequestToken getOAuthRequestToken() throws TwitterException
OAuthSupport
getOAuthRequestToken
in interface OAuthSupport
TwitterException
- when Twitter service or network is unavailablepublic abstract RequestToken getOAuthRequestToken(java.lang.String callbackUrl) throws TwitterException
OAuthSupport
getOAuthRequestToken
in interface OAuthSupport
callbackUrl
- callback URLTwitterException
- when Twitter service or network is unavailablepublic abstract AccessToken getOAuthAccessToken() throws TwitterException
OAuthSupport
getOAuthAccessToken
in interface OAuthSupport
TwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic abstract AccessToken getOAuthAccessToken(java.lang.String oauthVerifier) throws TwitterException
OAuthSupport
getOAuthAccessToken
in interface OAuthSupport
oauthVerifier
- OAuth verifier. AKA pin.TwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic abstract AccessToken getOAuthAccessToken(RequestToken requestToken) throws TwitterException
OAuthSupport
getOAuthAccessToken
in interface OAuthSupport
requestToken
- the request tokenTwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic abstract AccessToken getOAuthAccessToken(RequestToken requestToken, java.lang.String oauthVerifier) throws TwitterException
OAuthSupport
getOAuthAccessToken
in interface OAuthSupport
requestToken
- the request tokenoauthVerifier
- OAuth verifier. AKA pin.TwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic abstract void setOAuthAccessToken(AccessToken accessToken)
OAuthSupport
setOAuthAccessToken
in interface OAuthSupport
accessToken
- accessTokenpublic abstract AccessToken getOAuthAccessToken(java.lang.String token, java.lang.String tokenSecret) throws TwitterException
OAuthSupport
getOAuthAccessToken
in interface OAuthSupport
token
- the screen nametokenSecret
- the passwordTwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic abstract AccessToken getOAuthAccessToken(java.lang.String token, java.lang.String tokenSecret, java.lang.String pin) throws TwitterException
getOAuthAccessToken(twitter4j.http.RequestToken, String)
insteadtoken
- request tokentokenSecret
- request token secretpin
- pinTwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic abstract void setOAuthAccessToken(java.lang.String token, java.lang.String tokenSecret)
TwitterFactory.getInstance(twitter4j.http.Authorization)
insteadtoken
- access tokentokenSecret
- access token secretjava.lang.IllegalStateException
- when AccessToken has already been retrieved or setpublic boolean isOAuthEnabled()
public void setRateLimitStatusListener(RateLimitStatusListener listener)
listener
- the listener to be addedpublic boolean equals(java.lang.Object o)
equals
in class TwitterBase
public int hashCode()
hashCode
in class TwitterBase
public void httpResponseReceived(twitter4j.internal.http.HttpResponseEvent event)
httpResponseReceived
in interface twitter4j.internal.http.HttpResponseListener