List of usage examples for org.springframework.util MultiValueMap setAll
void setAll(Map<K, V> values);
From source file:org.encuestame.social.api.IdenticaAPITemplate.java
public TweetPublishedMetadata updateStatus(final String message, final IdenticaStatusDetails details) { log.debug("Identica updateStatus 1 " + message); log.debug("Identica updateStatus 1 " + details); final MultiValueMap<String, Object> tweetParams = new LinkedMultiValueMap<String, Object>(); tweetParams.add("status", message); tweetParams.setAll(details.toParameterMap()); final ResponseEntity<Map> response = getRestTemplate().postForEntity(TWEET_URL, tweetParams, Map.class); /**/*from ww w.j ava2s.com*/ * {text=fdfasfasfadfa fas fa fda sfda dsadsads http://tinyurl.com/3p3fs2a dasdsadsa http://tinyurl.com/4xnfgws #dasdsaas, * truncated=false, created_at=Sun May 22 23:30:03 +0000 2011, in_reply_to_status_id=null, * source=<a href="http://www.encuestame.org" rel="nofollow">encuestame</a>, * ---ID STATUS----> id=74199692, * in_reply_to_user_id=null, in_reply_to_screen_name=null, geo=null, * favorited=false, attachments=[], user={id=423318, name=jpicado, screen_name=jpicado, * location=null, description=null, profile_image_url=http://theme.identi.ca/0.9.7/identica/default-avatar-stream.png, * url=null, protected=false, followers_count=0, profile_background_color=, * profile_text_color=, profile_link_color=, profile_sidebar_fill_color=, * profile_sidebar_border_color=, friends_count=2, created_at=Thu Apr 21 23:15:53 +0000 2011, * favourites_count=0, utc_offset=0, time_zone=UTC, profile_background_image_url=, * profile_background_tile=false, statuses_count=40, following=true, statusnet:blocking=false, * notifications=true, statusnet_profile_url=http://identi.ca/jpicado}, * statusnet_html=fdfasfasfadfa fas fa fda sfda dsadsads <a href="http://tinyurl.com/3p3fs2a" * title="http://tinyurl.com/3p3fs2a" rel="nofollow external">http://tinyurl.com/3p3fs2a</a> dasdsadsa * <a href="http://tinyurl.com/4xnfgws" title="http://tinyurl.com/4xnfgws" * rel="nofollow external">http://tinyurl.com/4xnfgws</a> #<span class="tag"> * <a href="http://identi.ca/tag/dasdsaas" rel="tag">dasdsaas</a></span>} */ log.debug("Identica updateStatus " + response.getBody()); log.debug("Identica updateStatus " + response.getHeaders()); log.debug("Identica updateStatus " + response.getStatusCode()); final Map body = response.getBody(); //this.handleIdentiCaResponseErrors(response); final TweetPublishedMetadata status = createStatus(message); status.setTweetId(body.get("id").toString()); return status; }
From source file:org.springframework.social.oauth1.SigningSupport.java
/** * Builds the authorization header.//ww w . j av a 2 s . c o m * The elements in additionalParameters are expected to not be encoded. */ public String buildAuthorizationHeaderValue(HttpMethod method, URI targetUrl, Map<String, String> oauthParameters, MultiValueMap<String, String> additionalParameters, String consumerSecret, String tokenSecret) { StringBuilder header = new StringBuilder(); header.append("OAuth "); for (Entry<String, String> entry : oauthParameters.entrySet()) { header.append(oauthEncode(entry.getKey())).append("=\"").append(oauthEncode(entry.getValue())) .append("\", "); } MultiValueMap<String, String> collectedParameters = new LinkedMultiValueMap<String, String>( (int) ((oauthParameters.size() + additionalParameters.size()) / .75 + 1)); collectedParameters.setAll(oauthParameters); collectedParameters.putAll(additionalParameters); String baseString = buildBaseString(method, getBaseStringUri(targetUrl), collectedParameters); String signature = calculateSignature(baseString, consumerSecret, tokenSecret); header.append(oauthEncode("oauth_signature")).append("=\"").append(oauthEncode(signature)).append("\""); return header.toString(); }