Package org.springframework.web.util

Examples of org.springframework.web.util.UriTemplate.expand()


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


        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();
  }

  private String generateCode(AuthorizationRequest authorizationRequest, Authentication authentication)
      throws AuthenticationException {
View Full Code Here

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

    Assert.notNull(controller, "Controller type must not be null!");
    Assert.notNull(method, "Method must not be null!");

    UriTemplate template = new UriTemplate(DISCOVERER.getMapping(controller, method));
    URI uri = template.expand(parameters);

    return new ControllerLinkBuilder(getBuilder()).slash(uri);
  }

  /**
 
View Full Code Here

  /**
   * @see org.springframework.web.servlet.support.RequestContext#getContextUrl(String, Map)
   */
  public String getContextUrl(String relativeUrl, Map<String,String> params) {
    UriTemplate template = new UriTemplate(relativeUrl);
    return getContextPath() + template.expand(params).toASCIIString();
  }

  /**
   * @see org.springframework.web.servlet.support.RequestContext#getBindStatus(String)
   */
 
View Full Code Here

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

  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);
  }

  public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables) throws RestClientException {
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);
  }

  public <T> T execute(URI url, HttpMethod method, RequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor) throws RestClientException {
View Full Code Here

  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);
  }

  public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables) throws RestClientException {
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);
  }

  public <T> T execute(URI url, HttpMethod method, RequestCallback requestCallback,
      ResponseExtractor<T> responseExtractor) throws RestClientException {
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.