示例#1
0
 /** {@inheritDoc} */
 @Override
 public AccessToken getOAuthAccessToken() throws MoefouException {
   ensureTokenIsAvailable();
   if (oauthToken instanceof AccessToken) return (AccessToken) oauthToken;
   oauthToken = new AccessToken(http.post(conf.getOAuthAccessTokenURL(), this));
   return (AccessToken) oauthToken;
 }
示例#2
0
 /** {@inheritDoc} */
 @Override
 public AccessToken getOAuthAccessToken(final String oauthVerifier) throws MoefouException {
   ensureTokenIsAvailable();
   final String url = conf.getOAuthAccessTokenURL();
   oauthToken =
       new AccessToken(
           http.post(
               url,
               new HttpParameter[] {new HttpParameter("oauth_verifier", oauthVerifier)},
               this));
   return (AccessToken) oauthToken;
 }
示例#3
0
 /** {@inheritDoc} */
 @Override
 public RequestToken getOAuthRequestToken(final String callbackURL) throws MoefouException {
   if (oauthToken instanceof AccessToken)
     throw new IllegalStateException("Access token already available.");
   final List<HttpParameter> params = new ArrayList<HttpParameter>();
   if (callbackURL != null) {
     params.add(new HttpParameter("oauth_callback", callbackURL));
   }
   final String url = conf.getOAuthRequestTokenURL();
   oauthToken =
       new RequestToken(
           conf, http.post(url, params.toArray(new HttpParameter[params.size()]), this), this);
   return (RequestToken) oauthToken;
 }