StringUtils { public static boolean requestUriMatch(String uri, Set<String> uriSet, List<Pattern> uriList) { if (uriSet != null && uriSet.contains(uri)) { return true; } if (uriList != null) { for (Pattern pattern : uriList) { Matcher matcher = pattern.matcher(uri); if (matcher.matches()) { return true; } } } return false; }  static boolean isRegexMetaCharacter(char regexChar); static boolean containsMatchCharacter(String name); static String patternFromGlob(String glob); static boolean containsControlCharacter(String value); static boolean requestUriMatch(String uri, Set<String> uriSet,
            List<Pattern> uriList);  }
@Test public void testRequestUriMatch() { assertFalse(StringUtils.requestUriMatch("/zts/v1/schema", null, null)); assertFalse(StringUtils.requestUriMatch("/zts/v1/schema", Collections.emptySet(), null)); assertFalse(StringUtils.requestUriMatch("/zts/v1/schema", null, Collections.emptyList())); Set<String> uriSet = new HashSet<>(); uriSet.add("/zts/v1/domain"); uriSet.add("/zts/v1/schema"); assertFalse(StringUtils.requestUriMatch("/zts/v1/token", uriSet, null)); assertTrue(StringUtils.requestUriMatch("/zts/v1/domain", uriSet, null)); assertTrue(StringUtils.requestUriMatch("/zts/v1/schema", uriSet, null)); List<Pattern> uriList = new ArrayList<>(); uriList.add(Pattern.compile("/zts/v1/domain/.+/service/.+/publickey/.+")); assertFalse(StringUtils.requestUriMatch("/zts/v1/domain/athenz/service/zms/publickey/", uriSet, uriList)); assertFalse(StringUtils.requestUriMatch("/zts/v1/domain/athenz", uriSet, uriList)); assertFalse(StringUtils.requestUriMatch("/zts/v1/domain/athenz/token", uriSet, uriList)); assertFalse(StringUtils.requestUriMatch("/zts/v1/domain/athenz/service/zms", uriSet, uriList)); assertTrue(StringUtils.requestUriMatch("/zts/v1/domain/athenz/service/zms/publickey/zms1", uriSet, uriList)); }