Example #1
0
 /**
  * Get a {@link Map} of the query string parameters.
  *
  * @return a map containing the query string parameters
  * @throws OAuthException if the URL is not valid
  */
 public Map<String, String> getQueryStringParams() {
   try {
     Map<String, String> params = new HashMap<String, String>();
     String queryString = new URL(url).getQuery();
     params.putAll(MapUtils.queryStringToMap(queryString));
     params.putAll(this.querystringParams);
     return params;
   } catch (MalformedURLException mue) {
     throw new OAuthException("Malformed URL", mue);
   }
 }
  private void addOAuthParams(OAuthRequest request, Token token) {
    request.addOAuthParameter(
        OAuthConstants.TIMESTAMP, api.getTimestampService().getTimestampInSeconds());
    request.addOAuthParameter(OAuthConstants.NONCE, api.getTimestampService().getNonce());
    request.addOAuthParameter(OAuthConstants.CONSUMER_KEY, config.getApiKey());
    request.addOAuthParameter(
        OAuthConstants.SIGN_METHOD, api.getSignatureService().getSignatureMethod());
    request.addOAuthParameter(OAuthConstants.VERSION, getVersion());
    if (config.hasScope()) {
      request.addOAuthParameter(OAuthConstants.SCOPE, config.getScope());
    }
    request.addOAuthParameter(OAuthConstants.SIGNATURE, getSignature(request, token));

    config.log(
        "appended additional OAuth parameters: " + MapUtils.toString(request.getOauthParameters()));
  }