ParameterizedPathMatcher implements PathMatcher { public boolean match(String pattern, String path) { return getOrCreatePattern(pattern).matcher(path).matches(); }  boolean isPattern(String string); boolean match(String pattern, String path); boolean matchStart(String pattern, String path); Map<String, String> namedParameters(String pattern, String path); String extractPathWithinPattern(String pattern, String path); Map<String, String> extractUriTemplateVariables(String pattern, String path); Comparator<String> getPatternComparator(String path); String combine(String pattern1, String pattern2);  }
@Test public void testMatchesWithoutName() { ParameterizedPathMatcher pathMatcher = new ParameterizedPathMatcher(); assertTrue(pathMatcher.match("com/t?st.jsp", "com/test.jsp")); assertTrue(pathMatcher.match("com/t?st.jsp", "com/tast.jsp")); assertTrue(pathMatcher.match("com/t?st.jsp", "com/txst.jsp")); assertFalse(pathMatcher.match("com/t?st.jsp", "com/text.jsp")); assertTrue(pathMatcher.match("comtest.jsp", "com/test.jsp")); assertTrue(pathMatcher.match("comtest.jsp", "com/foo/test.jsp")); assertFalse(pathMatcher.match("comtest.jsp", "com/foo/text.jsp")); assertFalse(pathMatcher.match("comtest.jsp", "com/foo/test")); assertTrue(pathMatcher.match("org/springframework*.jsp", "org/springframework/test.jsp")); assertTrue(pathMatcher.match("org/springframework*.jsp", "org/springframework/feed/foo.jsp")); assertFalse(pathMatcher.match("org/springframework*.jsp", "org/springframework/test.txt")); assertFalse(pathMatcher.match("org/springframework*.jsp", "com/springframework/feed/foo.jsp")); assertTrue(pathMatcher.match("orgservlet/bla.jsp", "org/springframework/servlet/bla.jsp")); assertTrue(pathMatcher.match("orgservlet/bla.jsp", "org/springframework/testing/servlet/bla.jsp")); assertTrue(pathMatcher.match("orgservlet/bla.jsp", "org/servlet/bla.jsp")); }
@Test public void testMatchesWithName() { ParameterizedPathMatcher pathMatcher = new ParameterizedPathMatcher(); assertTrue(pathMatcher.match("com/(t?st.jsp:jsp)", "com/test.jsp")); assertTrue(pathMatcher.match("com/(t?st.jsp:jsp)", "com/tast.jsp")); assertTrue(pathMatcher.match("com/(t?st.jsp:jsp)", "com/txst.jsp")); assertFalse(pathMatcher.match("com/(t?st.jsp:jsp)", "com/text.jsp")); assertTrue(pathMatcher.match("com/(*.jsp:jsp)", "com/test.jsp")); assertTrue(pathMatcher.match("com/(*.jsp:jsp)", "com/foo.jsp")); assertTrue(pathMatcher.match("com/(*.jsp:jsp)", "com/feed.jsp")); assertFalse(pathMatcher.match("com/(*.jsp:jsp)", "com/feed.jxp")); assertFalse(pathMatcher.match("com/(*.jsp:jsp)", "com/testxjsp")); assertFalse(pathMatcher.match("com/(*.jsp:jsp)", "com/test/test.jsp")); assertTrue(pathMatcher.match("com/(**/test.jsp:path)", "com/test.jsp")); assertTrue(pathMatcher.match("com(test.jsp:jsp)", "com/foo/test.jsp")); assertFalse(pathMatcher.match("com/(**:path)/test.jsp", "com/foo/text.jsp")); assertFalse(pathMatcher.match("comtest.jsp", "com/foo/test")); assertTrue(pathMatcher.match("org/springframework/(***:view).jsp", "org/springframework/feed/foo.jsp")); assertFalse(pathMatcher.match("org/springframework/(***:view).jsp", "com/springframework/feed/foo.jsp")); assertTrue(pathMatcher.match("org/(**:path)/servlet/bla.jsp", "org/springframework/servlet/bla.jsp")); assertTrue(pathMatcher.match("org/(**:path)/servlet/bla.jsp", "org/springframework/testing/servlet/bla.jsp")); assertTrue(pathMatcher.match("org/(**:path)/servlet/bla.jsp", "org/servlet/bla.jsp")); assertTrue(pathMatcher.match("/list/(*:name)/(***:path)*", "/list/sandbox/trunk/dev/?revision=123")); }