public class OAuth1 extends Object implements OAuth
OAuth.Method| Modifier and Type | Field and Description |
|---|---|
protected static String |
OAUTH_TOKEN
Service response item specifying a token's value
|
protected static String |
OAUTH_TOKEN_SECRET
Service response item specifying a token's secret
|
| Constructor and Description |
|---|
OAuth1(String consumerKey,
String consumerSecret)
Creates a new OAuth client
|
| Modifier and Type | Method and Description |
|---|---|
Response |
request(URL url,
OAuth.Method method,
Token token)
Sends a request to the server and returns an input stream from which
the response can be read.
|
Response |
request(URL url,
OAuth.Method method,
Token token,
Map<String,String> additionalHeaders)
Sends a request to the server and returns an input stream from which
the response can be read.
|
Token |
requestTemporaryCredentials(URL url,
OAuth.Method method)
Requests temporary credentials.
|
Token |
requestTokenCredentials(URL url,
OAuth.Method method,
Token temporaryCredentials,
String verifier)
Requests token credentials.
|
protected Token |
responseToToken(Map<String,String> response)
Parses a service response and creates a token
|
protected static final String OAUTH_TOKEN
protected static final String OAUTH_TOKEN_SECRET
public Token requestTemporaryCredentials(URL url, OAuth.Method method) throws IOException
OAuthrequestTemporaryCredentials in interface OAuthurl - the URL from which the temporary credentials should be requestedmethod - the HTTP request methodIOException - if the request was not successfulRequestException - if the server returned an errorUnauthorizedException - if the request is not authorizedpublic Token requestTokenCredentials(URL url, OAuth.Method method, Token temporaryCredentials, String verifier) throws IOException
OAuthOAuth.requestTemporaryCredentials(URL, Method)requestTokenCredentials in interface OAuthurl - the URL from which the token credentials should be requestedmethod - the HTTP request methodtemporaryCredentials - the temporary credentialsverifier - the verification code returned by the OAuth serverIOException - if the request was not successfulRequestException - if the server returned an errorUnauthorizedException - if the request is not authorizedpublic Response request(URL url, OAuth.Method method, Token token) throws IOException
OAuthrequest in interface OAuthurl - the URL to send the request tomethod - the HTTP request methodtoken - a token used for authorization (may be null if the
authorization is not required for this request)IOException - if the request was not successfulRequestException - if the server returned an errorUnauthorizedException - if the request is not authorizedpublic Response request(URL url, OAuth.Method method, Token token, Map<String,String> additionalHeaders) throws IOException
OAuthrequest in interface OAuthurl - the URL to send the request tomethod - the HTTP request methodtoken - a token used for authorization (may be null if the
authorization is not required for this request)additionalHeaders - additional HTTP headers (may be null)IOException - if the request was not successfulRequestException - if the server returned an errorUnauthorizedException - if the request is not authorized