Refine AntPathMatcher.combine when p1 contains '.'

Refine AntPathMatcher.combine rules to allow direct concatenation of
patterns when pattern1 does not contain '*.'. Prior to this commit
direct concatenation was allowed when pattern1 did not contain '.',
this prevented calls of the form:

	pathMatcher.combine("/1.0", "/foo/test")

from working as expected.

This commit also applies some general cleanup to the `combine` method.

Issue: SPR-10554
This commit is contained in:
Phillip Webb
2013-08-26 18:22:22 -07:00
parent 57dfc13f30
commit c1dafed886
2 changed files with 33 additions and 49 deletions

View File

@@ -399,6 +399,7 @@ public class AntPathMatcherTests {
assertEquals("/hotels/**/booking", pathMatcher.combine("/hotels/**", "/booking"));
assertEquals("/hotels/booking", pathMatcher.combine("/hotels", "/booking"));
assertEquals("/hotels/booking", pathMatcher.combine("/hotels", "booking"));
assertEquals("/hotels/booking", pathMatcher.combine("/hotels/", "booking"));
assertEquals("/hotels/{hotel}", pathMatcher.combine("/hotels/*", "{hotel}"));
assertEquals("/hotels/**/{hotel}", pathMatcher.combine("/hotels/**", "{hotel}"));
assertEquals("/hotels/{hotel}", pathMatcher.combine("/hotels", "{hotel}"));
@@ -413,6 +414,7 @@ public class AntPathMatcherTests {
assertEquals("/{foo}/bar", pathMatcher.combine("/{foo}", "/bar")); // SPR-8858
assertEquals("/user/user", pathMatcher.combine("/user", "/user")); // SPR-7970
assertEquals("/{foo:.*[^0-9].*}/edit/", pathMatcher.combine("/{foo:.*[^0-9].*}", "/edit/")); // SPR-10062
assertEquals("/1.0/foo/test", pathMatcher.combine("/1.0", "/foo/test")); // SPR-10554
}
@Test