Package org.springframework.social.support

Examples of org.springframework.social.support.URIBuilder


      @RequestParam("error") String error,
      @RequestParam(value="error_description", required=false) String errorDescription,
      @RequestParam(value="error_uri", required=false) String errorUri,
      NativeWebRequest request) {
    logger.warn("Error during authorization: " + error);
    URIBuilder uriBuilder = URIBuilder.fromUri(signInUrl).queryParam("error", error);
    if (errorDescription != null ) { uriBuilder.queryParam("error_description", errorDescription); }
    if (errorUri != null ) { uriBuilder.queryParam("error_uri", errorUri); }
    return redirect(uriBuilder.build().toString());
  }
View Full Code Here


  protected URI buildUri(String path) {
    return buildUri(path, Collections.<String, String>emptyMap());
  }
 
  protected URI buildUri(String path, Map<String, String> params) {
    URIBuilder uriBuilder = foursquare.withAccessToken(API_URL_BASE + path);
    uriBuilder.queryParam("v", API_VERSION);
    for (String paramName : params.keySet()) {
      uriBuilder.queryParam(paramName, String.valueOf(params.get(paramName)));
    }
    URI uri = uriBuilder.build();
    return uri;
  }
View Full Code Here

      @RequestParam("error") String error,
      @RequestParam(value="error_description", required=false) String errorDescription,
      @RequestParam(value="error_uri", required=false) String errorUri,
      NativeWebRequest request) {
    logger.warn("Error during authorization: " + error);
    URIBuilder uriBuilder = URIBuilder.fromUri(signInUrl).queryParam("error", error);
    if (errorDescription != null ) { uriBuilder.queryParam("error_description", errorDescription); }
    if (errorUri != null ) { uriBuilder.queryParam("error_uri", errorUri); }
    return redirect(uriBuilder.build().toString());
  }
View Full Code Here


  @Override
  protected URI buildUri() {

    URIBuilder b = URIBuilder.fromUri(API_URL_BASE);


    b.queryParam("q", query);


    if (!includeEntities) {
      b.queryParam("include_entities", "false");
    }

    if (!resultType.equals(ResultType.mixed)) {
      b.queryParam("result_type", resultType.toString());
    }

    if (StringUtils.hasText(getLanguage())) {
      b.queryParam("lang", getLanguage());
    }


    if (StringUtils.hasText(geocode)) {
      b.queryParam("geocode", geocode);
    }

    if (sinceId != null) {
      b.queryParam("since_id", String.valueOf(sinceId));
    }

    URI uri = b.build();
    if (logger.isDebugEnabled()) {
      logger.debug("Search uri:" + uri);
    }
    return uri;
  }
View Full Code Here

    if (StringUtils.hasText(track) || StringUtils.hasText(follow) || StringUtils.hasText(locations)) {
      path = "statuses/filter.json";
    }

    URIBuilder b = URIBuilder.fromUri(API_URL_BASE + path);

    if (delimited) {
      b.queryParam("delimited", "length");
    }

    if (stallWarnings) {
      b.queryParam("stall_warnings", "true");
    }

    if (!FilterLevel.none.equals(filterLevel)) {
      b.queryParam("filter_level", filterLevel.toString());
    }

    if (StringUtils.hasText(getLanguage())) {
      b.queryParam("language", getLanguage());
    }

    if (StringUtils.hasText(track)) {
      b.queryParam("track", track);
    }

    if (StringUtils.hasText(follow)) {
      b.queryParam("follow", follow);
    }

    if (StringUtils.hasText(locations)) {
      b.queryParam("locations", locations);
    }
    return b.build();
  }
View Full Code Here

    return fetchConnections(objectId, connectionType, type, queryParameters);
  }

  public <T> PagedList<T> fetchConnections(String objectId, String connectionType, Class<T> type, MultiValueMap<String, String> queryParameters) {
    String connectionPath = connectionType != null && connectionType.length() > 0 ? "/" + connectionType : "";
    URIBuilder uriBuilder = URIBuilder.fromUri(GRAPH_API_URL + objectId + connectionPath).queryParams(queryParameters);
    JsonNode jsonNode = getRestTemplate().getForObject(uriBuilder.build(), JsonNode.class);
    return pagify(type, jsonNode);
  }
View Full Code Here

    return pagify(type, jsonNode);
  }

  public <T> PagedList<T> fetchPagedConnections(String objectId, String connectionType, Class<T> type, MultiValueMap<String, String> queryParameters) {
    String connectionPath = connectionType != null && connectionType.length() > 0 ? "/" + connectionType : "";
    URIBuilder uriBuilder = URIBuilder.fromUri(GRAPH_API_URL + objectId + connectionPath).queryParams(queryParameters);
    JsonNode jsonNode = getRestTemplate().getForObject(uriBuilder.build(), JsonNode.class);
    return pagify(type, jsonNode);
  }
View Full Code Here

    return searchHomeFeed(query, FIRST_PAGE);
  }
 
  public PagedList<Post> searchHomeFeed(String query, PagingParameters pagedListParameters) {
    requireAuthorization();
    URIBuilder uriBuilder = URIBuilder.fromUri(GraphApi.GRAPH_API_URL + "me/home").queryParam("q", query);
    uriBuilder = appendPagedListParameters(pagedListParameters, uriBuilder);
    URI uri = uriBuilder.build();
    JsonNode responseNode = restTemplate.getForObject(uri, JsonNode.class);
    return deserializeList(responseNode, null, Post.class);
  }
View Full Code Here

    return searchUserFeed(userId, query, FIRST_PAGE);
  }
 
  public PagedList<Post> searchUserFeed(String userId, String query, PagingParameters pagedListParameters) {
    requireAuthorization();
    URIBuilder uriBuilder = URIBuilder.fromUri(GraphApi.GRAPH_API_URL + userId + "/feed").queryParam("q", query);
    uriBuilder = appendPagedListParameters(pagedListParameters, uriBuilder);   
    URI uri = uriBuilder.build();
    JsonNode responseNode = restTemplate.getForObject(uri, JsonNode.class);
    return deserializeList(responseNode, null, Post.class);
  }
View Full Code Here

  }
 
  // private helpers
 
  private JsonNode fetchConnectionList(String baseUri, PagingParameters pagedListParameters) {
    URIBuilder uriBuilder = URIBuilder.fromUri(baseUri);
    uriBuilder = appendPagedListParameters(pagedListParameters, uriBuilder);
    URI uri = uriBuilder.build();
    JsonNode responseNode = restTemplate.getForObject(uri, JsonNode.class);
    return responseNode;
  }
View Full Code Here

TOP

Related Classes of org.springframework.social.support.URIBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.