Package org.springframework.web.util

Examples of org.springframework.web.util.UriComponentsBuilder.queryParam()


  }

  private String encodeUrl(String baseUrl, Map<String, List<String>> parameters) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(baseUrl);
    for (Map.Entry<String, List<String>> entry : parameters.entrySet()) {
      builder.queryParam(entry.getKey(), entry.getValue().toArray());
    }
    return builder.buildAndExpand().toUriString();
  }

View Full Code Here


    if (authorizationCode == null) {
      throw new IllegalStateException("No authorization code found in the current request scope.");
    }

    UriComponentsBuilder template = UriComponentsBuilder.fromUriString(authorizationRequest.getRedirectUri());
    template.queryParam("code", authorizationCode);

    String state = authorizationRequest.getState();
    if (state != null) {
      template.queryParam("state", state);
    }
View Full Code Here

    UriComponentsBuilder template = UriComponentsBuilder.fromUriString(authorizationRequest.getRedirectUri());
    template.queryParam("code", authorizationCode);

    String state = authorizationRequest.getState();
    if (state != null) {
      template.queryParam("state", state);
    }

    return template.build().encode().toUriString();
  }
View Full Code Here

    MockHttpServletResponse response = request(orders);
    Link orderLink = assertContentLinkWithRel("self", response, true).expand();

    UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(orderLink.getHref());
    String uri = builder.queryParam("projection", "summary").build().toUriString();

    response = mvc.perform(get(uri)). //
        andExpect(status().isOk()). //
        andExpect(jsonPath("$.price", is(2.5))).//
        andReturn().getResponse();
View Full Code Here

    public List<Question> searchForQuestionsTagged(String... tags) {
        UriComponentsBuilder builder = getBuilderFor(baseUrl + SEARCH_TEMPLATE);

        if (tags.length > 0) {
            String tagsString = StringUtils.arrayToDelimitedString(tags, ";");
            builder = builder.queryParam(TAGGED_PARAM, tagsString);
        }

        UriComponents uriComponents = builder.build();

        Questions result = restClient.get(restOperations, uriComponents.toUriString(), Questions.class);
View Full Code Here

    private UriComponentsBuilder getBuilderFor(String uri) {
        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(uri);

        for (Entry<String, String> entry : PARAMETERS.entrySet()) {
            builder.queryParam(entry.getKey(), entry.getValue());
        }

        return builder;
    }
}
View Full Code Here

      Object value = parameter.getValue();
      String key = parameter.getVariableName();

      if (value instanceof Collection) {
        for (Object element : (Collection<?>) value) {
          builder.queryParam(key, element);
        }
      } else {
        builder.queryParam(key, parameter.asString());
      }
    }
View Full Code Here

      if (value instanceof Collection) {
        for (Object element : (Collection<?>) value) {
          builder.queryParam(key, element);
        }
      } else {
        builder.queryParam(key, parameter.asString());
      }
    }

    UriComponents components = applyUriComponentsContributer(builder, invocation).buildAndExpand(values);
    return new ControllerLinkBuilder(UriComponentsBuilder.fromUriString(components.toUriString()));
View Full Code Here

  public IResponse geocode(IGeocodeRequest request) {

    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(URL);

    for (Map.Entry<String, String> entry : request.getParameters().entrySet())
      builder.queryParam(entry.getKey(), entry.getValue());

    URI uri = builder.buildAndExpand(request.getParameters()).toUri();

    return restTemplate.getForObject(uri, Response.class);
  }
View Full Code Here

  public IResponse reverseGeocode(IReverseGeocodeRequest request) {

    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(URL);

    for (Map.Entry<String, String> entry : request.getParameters().entrySet())
      builder.queryParam(entry.getKey(), entry.getValue());

    URI uri = builder.buildAndExpand(request.getParameters()).toUri();

    return restTemplate.getForObject(uri, Response.class);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.