Example usage for org.springframework.util PathMatcher match

List of usage examples for org.springframework.util PathMatcher match

Introduction

In this page you can find the example usage for org.springframework.util PathMatcher match.

Prototype

boolean match(String pattern, String path);

Source Link

Document

Match the given path against the given pattern , according to this PathMatcher's matching strategy.

Usage

From source file:org.springframework.js.resource.ResourceServlet.java

private boolean matchesCompressedMimeTypes(String mimeType) {
    PathMatcher pathMatcher = new AntPathMatcher();
    for (String compressedMimeType : compressedMimeTypes) {
        if (pathMatcher.match(compressedMimeType, mimeType)) {
            return true;
        }//  www .  j  ava2s .co m
    }
    return false;
}

From source file:org.springframework.js.resource.ResourceServlet.java

private boolean isAllowed(String resourcePath) {
    if (resourcePath.matches(protectedPath)) {
        return false;
    }/*www  .j  a va2 s  .  co m*/
    PathMatcher pathMatcher = new AntPathMatcher();
    for (String pattern : allowedResourcePaths) {
        if (pathMatcher.match(pattern, resourcePath)) {
            return true;
        }
    }
    return false;
}