Ensure correct recognition for start of match-the-rest path elements
Without this change the /{*foobar} and /** path elements were
not correctly enforcing that the first character they encounter
must be a separator. This problem was introduced when adjusting
the generated path element chains for these constructs. Originally
the generated chain included a SeparatorPathElement but in order for
these to match 'nothing' (i.e. /foo matches /foo/{*foobar}) the separator
path element was removed, so the separator enforcement needed moving
into the CaptureTheRestPathElement and WildcardTheRestPathElement.
Issue: SPR-14544
This commit is contained in:
committed by
Brian Clozel
parent
f58ffad939
commit
f786feb5e1
@@ -79,6 +79,11 @@ public class PathPatternMatcherTests {
|
||||
|
||||
@Test
|
||||
public void captureTheRest() {
|
||||
checkMatches("/resource/{*foobar}", "/resource");
|
||||
checkNoMatch("/resource/{*foobar}", "/resourceX");
|
||||
checkNoMatch("/resource/{*foobar}", "/resourceX/foobar");
|
||||
checkMatches("/resource/{*foobar}", "/resource/foobar");
|
||||
checkCapture("/resource/{*foobar}", "/resource/foobar", "foobar", "/foobar");
|
||||
checkCapture("/customer/{*something}", "/customer/99", "something", "/99");
|
||||
checkCapture("/customer/{*something}", "/customer/aa/bb/cc", "something",
|
||||
"/aa/bb/cc");
|
||||
@@ -124,6 +129,11 @@ public class PathPatternMatcherTests {
|
||||
checkMatches("a/*","a/");
|
||||
checkMatches("a/*","a/a");
|
||||
checkNoMatch("a/*","a/a/");
|
||||
|
||||
checkMatches("/resource/**", "/resource");
|
||||
checkNoMatch("/resource/**", "/resourceX");
|
||||
checkNoMatch("/resource/**", "/resourceX/foobar");
|
||||
checkMatches("/resource/**", "/resource/foobar");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user