Spring Framework has the AntPathMatcher which is borrowed from Ant.
I have the following path:
- /api/index
- /api/test/random
- /api/test/another
- /api/other/1
- /api/other/2
and I will add more paths like /api/other/other, I'd like to ask how can I create an AntPath Pattern to match all path except the /api/index.
I have tried to make some tests, but none of the following works.
private static final String PATTERN = "/api/*/**";
@Test
public void test() {
AntPathMatcher pathMatcher = new AntPathMatcher();
boolean match = pathMatcher.match(PATTERN, "/api/index");
System.out.println(match);
match = pathMatcher.match(PATTERN, "/api/test/test");
System.out.println(match);
}