org.springframework.social.support.URIBuilder Java Examples

The following examples show how to use org.springframework.social.support.URIBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: _SocialController.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 5 votes vote down vote up
@RequestMapping(value = "/signup", method = RequestMethod.GET)
public RedirectView signUp(WebRequest webRequest, @CookieValue(name = "NG_TRANSLATE_LANG_KEY", required = false, defaultValue = "\"<%= nativeLanguageShortName %>\"") String langKey) {
    try {
        Connection<?> connection = providerSignInUtils.getConnectionFromSession(webRequest);
        socialService.createSocialUser(connection, langKey.replace("\"", ""));
        return new RedirectView(URIBuilder.fromUri("/#/social-register/" + connection.getKey().getProviderId())
            .queryParam("success", "true")
            .build().toString(), true);
    } catch (Exception e) {
        log.error("Exception creating social user: ", e);
        return new RedirectView(URIBuilder.fromUri("/#/social-register/no-provider")
            .queryParam("success", "false")
            .build().toString(), true);
    }
}
 
Example #2
Source File: TwitterStreamMessageProducer.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
@Override
protected URI buildUri() {
	String path = this.twitterStreamProperties.getStreamType().equals(TwitterStreamType.FIREHOSE) ?
			"firehose.json" : "sample.json";
	URIBuilder b = URIBuilder.fromUri(API_URL_BASE + path);
	//TODO: Support all the available properties
	if (StringUtils.hasText(this.twitterStreamProperties.getLanguage())) {
		b.queryParam("language", this.twitterStreamProperties.getLanguage());
	}
	return b.build();
}
 
Example #3
Source File: AbstractYahooOperations.java    From cloudstreetmarket.com with GNU General Public License v3.0 5 votes vote down vote up
protected URI buildUri(YahooAPIType api, String path, MultiValueMap<String, String> parameters) {
 	if(api.equals(YahooAPIType.FINANCIAL) || api.equals(YahooAPIType.FINANCIAL_CHARTS_HISTO) || api.equals(YahooAPIType.FINANCIAL_CHARTS_INTRA)){
 		try {
	return new URI(getApiUrlBase(api) + path.replaceAll("\\^", "%5E"));
} catch (Exception e) {
	throw new IllegalArgumentException("The following url failed to build! "+ getApiUrlBase(api) + path.replaceAll("\\^", "%5E"));
}
 	}
 	else{
 		parameters.put("format", Arrays.asList("json"));
 		return URIBuilder.fromUri(String.format(getApiUrlBase(api) + path, guid)).queryParams(parameters).build();
 	}
 }