|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.fitbit.api.client.http.HttpClient
public class HttpClient
A utility class to handle HTTP request/response.
| Nested Class Summary | |
|---|---|
protected static class |
HttpClient.HttpMethod
|
| Field Summary | |
|---|---|
static int |
CONFLICT
|
protected static org.apache.commons.logging.Log |
log
|
static int |
NOT_AUTHORIZED
|
| Constructor Summary | |
|---|---|
HttpClient()
|
|
HttpClient(String userId,
String password)
|
|
| Method Summary | |
|---|---|
Response |
delete(String url)
|
Response |
delete(String url,
boolean authenticated)
|
static String |
encodeParameters(PostParameter[] postParams)
|
boolean |
equals(Object o)
|
Response |
get(String url)
|
Response |
get(String url,
boolean authenticated)
|
String |
getAccessTokenURL()
|
String |
getAuthenticationRL()
|
String |
getAuthorizationURL()
|
int |
getConnectionTimeout()
|
AccessToken |
getOAuthAccessToken(String token,
String tokenSecret,
String oauth_verifier)
|
AccessToken |
getOAuthAccessToken(TempCredentials token)
|
AccessToken |
getOAuthAccessToken(TempCredentials token,
String pin)
|
TempCredentials |
getOAuthRequestToken()
|
TempCredentials |
getOauthRequestToken(String callback_url)
|
String |
getPassword()
|
String |
getProxyAuthPassword()
|
String |
getProxyAuthUser()
|
String |
getProxyHost()
|
int |
getProxyPort()
|
int |
getReadTimeout()
|
String |
getRequestHeader(String name)
|
String |
getRequestTokenURL()
|
String |
getUserAgent()
|
String |
getUserId()
|
int |
hashCode()
|
protected Response |
httpRequest(HttpClient.HttpMethod method,
String url,
PostParameter[] postParams,
boolean authenticated)
|
boolean |
isAuthenticationEnabled()
|
Response |
post(String url)
|
Response |
post(String url,
boolean authenticated)
|
Response |
post(String url,
PostParameter[] postParameters)
|
Response |
post(String url,
PostParameter[] postParameters,
boolean authenticated)
|
void |
removeRequestHeader(String name)
|
void |
setAccessTokenURL(String accessTokenURL)
|
void |
setAuthorizationURL(String authorizationURL)
|
void |
setConnectionTimeout(int connectionTimeout)
Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection. |
void |
setOAuthAccessToken(AccessToken token)
Sets the authorized access token |
void |
setOAuthConsumer(String consumerKey,
String consumerSecret)
Sets the consumer key and consumer secret. System property -DFitbit4j.oauth.consumerKey and -Dhttp.oauth.consumerSecret override this attribute. |
void |
setPassword(String password)
|
void |
setProxyAuthPassword(String proxyAuthPassword)
Sets proxy authentication password. |
void |
setProxyAuthUser(String proxyAuthUser)
Sets proxy authentication user. |
void |
setProxyHost(String proxyHost)
Sets proxy host. |
void |
setProxyPort(int proxyPort)
Sets proxy port. |
void |
setReadTimeout(int readTimeout)
Sets the read timeout to a specified timeout, in milliseconds. |
void |
setRequestHeader(String name,
String value)
|
void |
setRequestTokenURL(String requestTokenURL)
|
void |
setRetryCount(int retryCount)
|
void |
setRetryIntervalSecs(int retryIntervalSecs)
|
void |
setUserAgent(String ua)
|
void |
setUserId(String userId)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
public static final int NOT_AUTHORIZED
public static final int CONFLICT
| Constructor Detail |
|---|
public HttpClient(String userId,
String password)
public HttpClient()
| Method Detail |
|---|
public void setUserId(String userId)
public void setPassword(String password)
public String getUserId()
public String getPassword()
public boolean isAuthenticationEnabled()
public void setOAuthConsumer(String consumerKey,
String consumerSecret)
consumerKey - consumer keyconsumerSecret - consumer secret
public TempCredentials getOAuthRequestToken()
throws FitbitAPIException
FitbitAPIException
public TempCredentials getOauthRequestToken(String callback_url)
throws FitbitAPIException
callback_url - callback url
FitbitAPIException
public AccessToken getOAuthAccessToken(TempCredentials token)
throws FitbitAPIException
token - request token
FitbitAPIException
public AccessToken getOAuthAccessToken(TempCredentials token,
String pin)
throws FitbitAPIException
token - request token
FitbitAPIException
public AccessToken getOAuthAccessToken(String token,
String tokenSecret,
String oauth_verifier)
throws FitbitAPIException
token - request tokentokenSecret - request token secretoauth_verifier - oauth_verifier or pin
FitbitAPIExceptionpublic void setOAuthAccessToken(AccessToken token)
token - authorized access tokenpublic void setRequestTokenURL(String requestTokenURL)
public String getRequestTokenURL()
public void setAuthorizationURL(String authorizationURL)
public String getAuthorizationURL()
public String getAuthenticationRL()
public void setAccessTokenURL(String accessTokenURL)
public String getAccessTokenURL()
public String getProxyHost()
public void setProxyHost(String proxyHost)
proxyHost - public int getProxyPort()
public void setProxyPort(int proxyPort)
proxyPort - public String getProxyAuthUser()
public void setProxyAuthUser(String proxyAuthUser)
proxyAuthUser - public String getProxyAuthPassword()
public void setProxyAuthPassword(String proxyAuthPassword)
proxyAuthPassword - public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout - - an int that specifies the connect timeout value in millisecondspublic int getReadTimeout()
public void setReadTimeout(int readTimeout)
readTimeout - - an int that specifies the timeout value to be used in millisecondspublic void setRetryCount(int retryCount)
public void setUserAgent(String ua)
public String getUserAgent()
public void setRetryIntervalSecs(int retryIntervalSecs)
public Response post(String url,
PostParameter[] postParameters,
boolean authenticated)
throws FitbitAPIException
FitbitAPIException
public Response post(String url,
boolean authenticated)
throws FitbitAPIException
FitbitAPIException
public Response post(String url,
PostParameter[] postParameters)
throws FitbitAPIException
FitbitAPIException
public Response post(String url)
throws FitbitAPIException
FitbitAPIException
public Response delete(String url)
throws FitbitAPIException
FitbitAPIException
public Response delete(String url,
boolean authenticated)
throws FitbitAPIException
FitbitAPIException
public Response get(String url,
boolean authenticated)
throws FitbitAPIException
FitbitAPIException
public Response get(String url)
throws FitbitAPIException
FitbitAPIException
protected Response httpRequest(HttpClient.HttpMethod method,
String url,
PostParameter[] postParams,
boolean authenticated)
throws FitbitAPIException
FitbitAPIExceptionpublic static String encodeParameters(PostParameter[] postParams)
public void setRequestHeader(String name,
String value)
public String getRequestHeader(String name)
public void removeRequestHeader(String name)
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||