Replace NAMES_PATTERN in UriTemplate

The URI template is now manually parsed vs using a regex to extract
URI variable names and to create a pattern for matching to actual URLs.
This provides more control to deal with nested curly braces.

Issue: SPR-13627
This commit is contained in:
Rossen Stoyanchev
2015-11-05 09:36:02 -05:00
parent 2ba5cb2734
commit 971f046913
2 changed files with 82 additions and 56 deletions

View File

@@ -143,6 +143,15 @@ public class UriTemplateTests {
assertEquals("Invalid match", expected, result);
}
// SPR-13627
@Test
public void matchCustomRegexWithNestedCurlyBraces() throws Exception {
UriTemplate template = new UriTemplate("/site.{domain:co.[a-z]{2}}");
Map<String, String> result = template.match("/site.co.eu");
assertEquals("Invalid match", Collections.singletonMap("domain", "co.eu"), result);
}
@Test
public void matchDuplicate() throws Exception {
UriTemplate template = new UriTemplate("/order/{c}/{c}/{c}");