Package org.springframework.web.util

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


   * @param 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


  // 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 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

      if (value != null) {
        url.append("&" + key + "={extra_" + key + "}");
        vars.put("extra_" + key, value);
      }
    }
    UriTemplate template = new UriTemplate(url.toString());
    // Do not include the refresh token (even if there is one)
    return template.expand(vars).toString();
  }
View Full Code Here

    RestTemplate client = new RestTemplate();
    boolean followRedirects = HttpURLConnection.getFollowRedirects();
    HttpURLConnection.setFollowRedirects(false);
    boolean online = false;
    try {
      client.getForEntity(new UriTemplate(getUrl("/sparklr2/login.jsp")).toString(), String.class);
      online = true;
      logger.info("Basic connectivity test passed");
    } catch (RestClientException e) {
      logger.warn(String.format(
          "Not executing tests because basic connectivity test failed for hostName=%s, port=%d", hostName,
View Full Code Here

    public Map<String, String> params() {
      return params;
    }

    public URI build() {
      return new UriTemplate(pattern()).expand(params);
    }
View Full Code Here

   * tests no double encoding of existing query parameter
   */
  @Test
  public void testNonEncodingOfUriTemplate() throws Exception {
    OAuth2AccessToken token = new DefaultOAuth2AccessToken("12345");
    UriTemplate uriTemplate = new UriTemplate("https://graph.facebook.com/fql?q={q}");
    URI expanded = uriTemplate.expand("[q: fql]");
    URI appended = restTemplate.appendQueryParameter(expanded, token);
    assertEquals("https://graph.facebook.com/fql?q=%5Bq:%20fql%5D&bearer_token=12345", appended.toString());
  }
View Full Code Here

    RestTemplate client = new RestTemplate();
    boolean followRedirects = HttpURLConnection.getFollowRedirects();
    HttpURLConnection.setFollowRedirects(false);
    boolean online = false;
    try {
      client.getForEntity(new UriTemplate(getUrl("/sparklr2/login.jsp")).toString(), String.class);
      online = true;
      logger.info("Basic connectivity test passed");
    }
    catch (RestClientException e) {
      logger.warn(String.format(
View Full Code Here

    public Map<String, String> params() {
      return params;
    }

    public URI build() {
      return new UriTemplate(pattern()).expand(params);
    }
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.