Package org.springframework.web.util

Examples of org.springframework.web.util.UriTemplate


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

    }
  };

  private AccountMapper(PictureUrlMapper pictureUrlMapper, String profileUrlTemplate) {
    this.pictureUrlMapper = pictureUrlMapper;
    this.profileUrlTemplate = new UriTemplate(profileUrlTemplate);
  }
View Full Code Here

  private final UriTemplate resetUriTemplate;
 
  @Inject
  public ResetPasswordMailMessageConverter(@Value("#{environment['application.secureUrl']}/reset?token={token}") String resetUriTemplate) {
    this.resetUriTemplate = new UriTemplate(resetUriTemplate);
  }
View Full Code Here

    private Account account;
   
    @Before
    public void setup() {
        interceptor = new AccountExposingHandlerInterceptor();
        account = new Account(1L, "Joe", "Schmoe", "joe@schmoe.com", "joe", "file://pic.jpg", new UriTemplate("http://localhost:8080/members/{profileKey}"));
        TestingAuthenticationToken authentication = new TestingAuthenticationToken(account, "password");
        SecurityContextHolder.getContext().setAuthentication(authentication);
    }
View Full Code Here

TOP

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

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.