class URLPatternMatcher {

    public boolean match(String requestedURL, Collection<String> patterns, boolean wildcard)
            throws MalformedURLException {
        boolean result = false;
        String patternLower;

        for (String pattern : patterns) {
            patternLower = pattern.toLowerCase();

            requestedURL = resourceName.canonicalize(requestedURL);

            // convert URI to URL if required (but not if pattern is relative)
            if (patternLower.startsWith("http")) {
                pattern = resourceName.canonicalize(pattern);
            }

            if (DEBUG.messageEnabled()) {
                DEBUG.message("URLPatternMatcher.match(" + requestedURL + "): matching by pattern: " + pattern);
            }

            ResourceMatch res = resourceName.compare(requestedURL, pattern, wildcard);

            if (res == ResourceMatch.WILDCARD_MATCH || res == ResourceMatch.EXACT_MATCH) {
                if (DEBUG.messageEnabled()) {
                    DEBUG.message("URLPatternMatcher.match(" + requestedURL + "): matched by pattern: " + pattern
                            + " result = " + res);
                }
                result = true;
                break;
            }
        }
        return result;
    }

    public  URLPatternMatcher();

}