Package org.springframework.web.util

Examples of org.springframework.web.util.UriTemplate$Parser


  @Override
  public <T> ListenableFuture<T> execute(String url, HttpMethod method, AsyncRequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor, Object... urlVariables) throws RestClientException {

    URI expanded = new UriTemplate(url).expand(urlVariables);
    return doExecute(expanded, method, requestCallback, responseExtractor);
  }
View Full Code Here


  @Override
  public <T> ListenableFuture<T> execute(String url, HttpMethod method, AsyncRequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables) throws RestClientException {

    URI expanded = new UriTemplate(url).expand(urlVariables);
    return doExecute(expanded, method, requestCallback, responseExtractor);
  }
View Full Code Here

   * @param params a map of parameters to insert as placeholders in the url
   * @return a URL that points back to the server with an absolute path (also URL-encoded accordingly)
   */
  public String getContextUrl(String relativeUrl, Map<String, ?> params) {
    String url = getContextPath() + relativeUrl;
    UriTemplate template = new UriTemplate(url);
    url = template.expand(params).toASCIIString();
    if (this.response != null) {
      url = this.response.encodeURL(url);
    }
    return url;
  }
View Full Code Here

    assertEquals(entity, requestEntity.getBody());
  }

  @Test
  public void uriVariablesExpansion() throws URISyntaxException {
    URI uri = new UriTemplate("http://example.com/{foo}").expand("bar");
    RequestEntity.get(uri).accept(MediaType.TEXT_PLAIN).build();

    String url = "http://www.{host}.com/{path}";
    String host = "example";
    String path = "foo/bar";
    URI expected = new URI("http://www.example.com/foo/bar");

    uri = new UriTemplate(url).expand(host, path);
    RequestEntity<?> entity = RequestEntity.get(uri).build();
    assertEquals(expected, entity.getUrl());

    Map<String, String> uriVariables = new HashMap<>(2);
    uriVariables.put("host", host);
    uriVariables.put("path", path);

    uri = new UriTemplate(url).expand(uriVariables);
    entity = RequestEntity.get(uri).build();
    assertEquals(expected, entity.getUrl());
  }
View Full Code Here

  // general execution

  public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor, Object... urlVariables) throws RestClientException {

    UriTemplate uriTemplate = new UriTemplate(url);
    URI expanded = uriTemplate.expand(urlVariables);
    return doExecute(expanded, method, requestCallback, responseExtractor);
  }
View Full Code Here

  }

  public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables) throws RestClientException {

    UriTemplate uriTemplate = new UriTemplate(url);
    URI expanded = uriTemplate.expand(urlVariables);
    return doExecute(expanded, method, requestCallback, responseExtractor);
  }
View Full Code Here

  // general execution

  public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor, Object... urlVariables) throws RestClientException {

    UriTemplate uriTemplate = new HttpUrlTemplate(url);
    URI expanded = uriTemplate.expand(urlVariables);
    return doExecute(expanded, method, requestCallback, responseExtractor);
  }
View Full Code Here

  }

  public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables) throws RestClientException {

    UriTemplate uriTemplate = new HttpUrlTemplate(url);
    URI expanded = uriTemplate.expand(urlVariables);
    return doExecute(expanded, method, requestCallback, responseExtractor);
  }
View Full Code Here

   * @param model the model to add item into
   * @param url the URL
   * @param sourceModel the source model
   */
  private void addUriTemplateParameters(Map<String, Object> model, String url, Map<String, ?> sourceModel) {
    UriTemplate uriTemplate = new UriTemplate(url);
    for (String name : uriTemplate.getVariableNames()) {
      if (!model.containsKey(name)) {
        Assert.state(sourceModel.containsKey(name), "Unable to find URL template variable '" + name
            + "' in source model");
        model.put(name, sourceModel.get(name));
      }
View Full Code Here

    // API

    public static URI createSearchUri(final String uriBase, final String paramToExpand) {
        URL url = null;
        try {
            url = new UriTemplate(uriBase).expand(paramToExpand).toURL();
        } catch (final MalformedURLException ex) {
            throw new IllegalArgumentException(ex);
        }

        try {
View Full Code Here

TOP

Related Classes of org.springframework.web.util.UriTemplate$Parser

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.