SPR-6482 - @RequestMapping handled incorrectly when value contains "." (dot) character

This commit is contained in:
Arjen Poutsma
2009-12-07 13:59:07 +00:00
parent f36e8252c8
commit 976f920db2
4 changed files with 55 additions and 10 deletions

View File

@@ -393,8 +393,8 @@ public class AntPathMatcherTests {
assertEquals(-1, comparator.compare("/hotels/{hotel}", "/hotels/*"));
assertEquals(1, comparator.compare("/hotels/*", "/hotels/{hotel}"));
assertEquals(-1, comparator.compare("/hotels/*", "/hotels/*/**"));
assertEquals(1, comparator.compare("/hotels/*/**", "/hotels/*"));
assertEquals(-2, comparator.compare("/hotels/*", "/hotels/*/**"));
assertEquals(2, comparator.compare("/hotels/*/**", "/hotels/*"));
assertEquals(-1, comparator.compare("/hotels/new", "/hotels/new.*"));
@@ -466,7 +466,6 @@ public class AntPathMatcherTests {
paths.add("/hotels/*");
paths.add("/hotels/{hotel}");
paths.add("/hotels/new");
Collections.shuffle(paths);
Collections.sort(paths, comparator);
assertEquals("/hotels/new", paths.get(0));
assertEquals("/hotels/{hotel}", paths.get(1));
@@ -480,6 +479,15 @@ public class AntPathMatcherTests {
assertEquals("/hotels/ne*", paths.get(0));
assertEquals("/hotels/n*", paths.get(1));
paths.clear();
comparator = pathMatcher.getPatternComparator("/hotels/new.html");
paths.add("/hotels/new.*");
paths.add("/hotels/{hotel}");
Collections.shuffle(paths);
Collections.sort(paths, comparator);
assertEquals("/hotels/new.*", paths.get(0));
assertEquals("/hotels/{hotel}", paths.get(1));
paths.clear();
}
}