Revert "Support {/var} syntax in UriComponentsBuilder"

This reverts commit a57d42829c after the
realization of a weaknesses with the proposed approach.

For example if a path segment contains both a /-prefixed and a regular
URI variable, there is no way to split that into a sequence of path
and path segments. The solution will have to be on the side of
UriComponents at the time of encoding.
This commit is contained in:
Rossen Stoyanchev
2015-03-23 16:44:03 -04:00
parent 95f6e4cc9b
commit 44e8f7b333
3 changed files with 12 additions and 52 deletions

View File

@@ -195,16 +195,6 @@ public class UriComponentsBuilderTests {
assertEquals("1USD=?EUR", result.getQueryParams().getFirst("q"));
}
//SPR-12750
@Test
public void fromUriStringWithVariablesRfc6570() {
String url = "http://example.com/part1/{/part2}/{var1}/url/{/urlvar}/";
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url);
UriComponents uriComponents = builder.build().expand("part/2", "var/1", "url/var").encode();
assertEquals("/part1/part%2F2/var/1/url/url%2Fvar/", uriComponents.getPath());
}
// SPR-10779
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,19 +98,6 @@ public class UriTemplateTests {
template.expand(uriVariables);
}
//SPR-12750
@Test
public void expandMapForRFC6570() throws Exception {
Map<String, String> uriVariables = new HashMap<String, String>(2);
uriVariables.put("hotel", "1");
uriVariables.put("publicpath", "pics/logo.png");
uriVariables.put("scale", "150x150");
UriTemplate template = new UriTemplate("/hotels/{hotel}/pic/{/publicpath}/size/{scale}");
URI result = template.expand(uriVariables);
assertEquals("Invalid expanded template", new URI("/hotels/1/pic/pics%2Flogo.png/size/150x150"), result);
}
@Test
public void expandEncoded() throws Exception {
UriTemplate template = new UriTemplate("http://example.com/hotel list/{hotel}");