public abstract class AbstractSession extends java.lang.Object implements Session
DropboxAPI. This is a base class to use for creating your own
Sessions.Session.AccessType, Session.ProxyInfo| Constructor and Description |
|---|
AbstractSession(AppKeyPair appKeyPair)
Creates a new session with the given app key and secret.
|
AbstractSession(AppKeyPair appKeyPair,
AccessTokenPair oauth1AccessToken)
Creates a new session with the given app key and secret.
|
AbstractSession(AppKeyPair appKeyPair,
Session.AccessType type)
Deprecated.
You don't need to specify the access type anymore. Use
AbstractSession(AppKeyPair). |
AbstractSession(AppKeyPair appKeyPair,
Session.AccessType type,
AccessTokenPair oauth1AccessToken)
Deprecated.
You don't need to specify the access type anymore. Use
AbstractSession(AppKeyPair, AccessTokenPair). |
AbstractSession(AppKeyPair appKeyPair,
java.lang.String oauth2AccessToken)
Creates a new session with the given app key and secret.
|
| Modifier and Type | Method and Description |
|---|---|
AccessTokenPair |
getAccessTokenPair()
Returns the currently logged in user's access token and secret.
|
Session.AccessType |
getAccessType()
Returns what Dropbox access type to use (currently app folder or entire
Dropbox).
|
java.lang.String |
getAPIServer()
Returns the Dropbox API server.
|
AppKeyPair |
getAppKeyPair()
Returns the app key and secret.
|
java.lang.String |
getContentServer()
Returns the Dropbox content server.
|
org.apache.http.client.HttpClient |
getHttpClient()
Will be called every time a request is made to Dropbox, in case you want
to use a new client every time.
|
java.util.Locale |
getLocale()
Returns the locale to use.
|
java.lang.String |
getOAuth2AccessToken() |
Session.ProxyInfo |
getProxyInfo()
Will be called every time a request is made to Dropbox, in case the
proxy changes between requests.
|
java.lang.String |
getWebServer()
Returns the Dropbox web server.
|
boolean |
isLinked()
Returns whether or not this session has a user's access token and
secret.
|
void |
setAccessTokenPair(AccessTokenPair accessTokenPair)
Links the session with the given OAuth 1 access token and secret.
|
void |
setOAuth2AccessToken(java.lang.String oauth2AccessToken) |
void |
setRequestTimeout(org.apache.http.client.methods.HttpUriRequest request)
Will be called every time right before a request is sent to Dropbox.
|
void |
sign(org.apache.http.HttpRequest request)
Signs the request using either OAuth 1 or OAuth 2, depending on which
token was set (setAccessTokenPair vs setOAuth2AccessToken).
|
void |
unlink()
Unlinks the session by removing any stored access token and secret.
|
public AbstractSession(AppKeyPair appKeyPair)
public AbstractSession(AppKeyPair appKeyPair, AccessTokenPair oauth1AccessToken)
public AbstractSession(AppKeyPair appKeyPair, java.lang.String oauth2AccessToken)
public AbstractSession(AppKeyPair appKeyPair, Session.AccessType type)
AbstractSession(AppKeyPair).public AbstractSession(AppKeyPair appKeyPair, Session.AccessType type, AccessTokenPair oauth1AccessToken)
AbstractSession(AppKeyPair, AccessTokenPair).public void setAccessTokenPair(AccessTokenPair accessTokenPair)
public void setOAuth2AccessToken(java.lang.String oauth2AccessToken)
public AppKeyPair getAppKeyPair()
SessiongetAppKeyPair in interface Sessionpublic AccessTokenPair getAccessTokenPair()
SessiongetAccessTokenPair in interface Sessionpublic java.lang.String getOAuth2AccessToken()
public Session.AccessType getAccessType()
SessiongetAccessType in interface Sessionpublic java.util.Locale getLocale()
Locale.ENLISH, but you
are highly encouraged to localize your application and return the system
locale instead. Note: as of the time this was written, Dropbox supports
the de, en, es, fr, and ja locales - if you use a locale other than
these, messages will be returned in English. However, it is good
practice to pass along the correct locale as we will add more languages
in the future.public boolean isLinked()
Sessionpublic void unlink()
Sessionpublic void sign(org.apache.http.HttpRequest request)
sign in interface Sessionrequest - an HttpRequest.Session.sign(org.apache.http.HttpRequest)public Session.ProxyInfo getProxyInfo()
Session.ProxyInfo object with a host and optionally a
port set.
getProxyInfo in interface Sessionpublic org.apache.http.client.HttpClient getHttpClient()
getHttpClient in interface Sessionpublic void setRequestTimeout(org.apache.http.client.methods.HttpUriRequest request)
setRequestTimeout in interface Sessionpublic java.lang.String getAPIServer()
SessiongetAPIServer in interface Sessionpublic java.lang.String getContentServer()
SessiongetContentServer in interface Sessionpublic java.lang.String getWebServer()
SessiongetWebServer in interface Session