public boolean match(String pattern, String path) { return delegate.match(pattern, path); }
if (getPathMatcher().match(fullPattern, currPath)) { result.add(content);
public boolean match(String pattern, String path) { return delegate.match(pattern, path); }
/** * Determine a match for the given lookup path. * @param lookupPath the current request path * @param pathMatcher a path matcher for path pattern matching * @return {@code true} if the interceptor applies to the given request path */ public boolean matches(String lookupPath, PathMatcher pathMatcher) { PathMatcher pathMatcherToUse = (this.pathMatcher != null ? this.pathMatcher : pathMatcher); if (!ObjectUtils.isEmpty(this.excludePatterns)) { for (String pattern : this.excludePatterns) { if (pathMatcherToUse.match(pattern, lookupPath)) { return false; } } } if (ObjectUtils.isEmpty(this.includePatterns)) { return true; } for (String pattern : this.includePatterns) { if (pathMatcherToUse.match(pattern, lookupPath)) { return true; } } return false; }
@Override @Nullable public CorsConfiguration getCorsConfiguration(HttpServletRequest request) { String lookupPath = this.urlPathHelper.getLookupPathForRequest(request); for (Map.Entry<String, CorsConfiguration> entry : this.corsConfigurations.entrySet()) { if (this.pathMatcher.match(entry.getKey(), lookupPath)) { return entry.getValue(); } } return null; }
@Nullable private String getMatchingPattern(String pattern, String lookupPath) { if (pattern.equals(lookupPath)) { return pattern; } if (this.useSuffixPatternMatch) { if (!this.fileExtensions.isEmpty() && lookupPath.indexOf('.') != -1) { for (String extension : this.fileExtensions) { if (this.pathMatcher.match(pattern + extension, lookupPath)) { return pattern + extension; } } } else { boolean hasSuffix = pattern.indexOf('.') != -1; if (!hasSuffix && this.pathMatcher.match(pattern + ".*", lookupPath)) { return pattern + ".*"; } } } if (this.pathMatcher.match(pattern, lookupPath)) { return pattern; } if (this.useTrailingSlashMatch) { if (!pattern.endsWith("/") && this.pathMatcher.match(pattern + "/", lookupPath)) { return pattern +"/"; } } return null; }
/** * Look up a {@link org.springframework.http.CacheControl} instance for the given URL path. * <p>Supports direct matches, e.g. a registered "/test" matches "/test", * and various Ant-style pattern matches, e.g. a registered "/t*" matches * both "/test" and "/team". For details, see the AntPathMatcher class. * @param urlPath the URL the bean is mapped to * @return the associated {@code CacheControl}, or {@code null} if not found * @see org.springframework.util.AntPathMatcher */ @Nullable protected CacheControl lookupCacheControl(String urlPath) { // Direct match? CacheControl cacheControl = this.cacheControlMappings.get(urlPath); if (cacheControl != null) { return cacheControl; } // Pattern match? for (String registeredPath : this.cacheControlMappings.keySet()) { if (this.pathMatcher.match(registeredPath, urlPath)) { return this.cacheControlMappings.get(registeredPath); } } return null; }
/** * Look up a cacheSeconds integer value for the given URL path. * <p>Supports direct matches, e.g. a registered "/test" matches "/test", * and various Ant-style pattern matches, e.g. a registered "/t*" matches * both "/test" and "/team". For details, see the AntPathMatcher class. * @param urlPath the URL the bean is mapped to * @return the cacheSeconds integer value, or {@code null} if not found * @see org.springframework.util.AntPathMatcher */ @Nullable protected Integer lookupCacheSeconds(String urlPath) { // Direct match? Integer cacheSeconds = this.cacheMappings.get(urlPath); if (cacheSeconds != null) { return cacheSeconds; } // Pattern match? for (String registeredPath : this.cacheMappings.keySet()) { if (this.pathMatcher.match(registeredPath, urlPath)) { return this.cacheMappings.get(registeredPath); } } return null; }
public void visit(Object vfsResource) { if (this.pathMatcher.match(this.subPattern, VfsPatternUtils.getPath(vfsResource).substring(this.rootPath.length()))) { this.resources.add(new VfsResource(vfsResource)); } }
@Override @Nullable public CorsConfiguration getCorsConfiguration(HttpServletRequest request) { String lookupPath = this.urlPathHelper.getLookupPathForRequest(request); for (Map.Entry<String, CorsConfiguration> entry : this.corsConfigurations.entrySet()) { if (this.pathMatcher.match(entry.getKey(), lookupPath)) { return entry.getValue(); } } return null; }
JarEntry entry = entries.nextElement(); String entryPath = entry.getName(); if (getPathMatcher().match(entryPattern, entryPath)) { result.add(new UrlResource( ResourceUtils.URL_PROTOCOL_JAR,
if (pattern.equals(destination) || this.pathMatcher.match(pattern, destination)) { matches.add(pattern);
public void updateAfterNewSubscription(String destination, String sessionId, String subsId) { synchronized (this.updateCache) { this.updateCache.forEach((cachedDestination, subscriptions) -> { if (getPathMatcher().match(destination, cachedDestination)) { // Subscription id's may also be populated via getSubscriptions() List<String> subsForSession = subscriptions.get(sessionId); if (subsForSession == null || !subsForSession.contains(subsId)) { subscriptions.add(sessionId, subsId); this.accessCache.put(cachedDestination, subscriptions.deepCopy()); } } }); } }
public void visit(Object vfsResource) { if (this.pathMatcher.match(this.subPattern, VfsPatternUtils.getPath(vfsResource).substring(this.rootPath.length()))) { this.resources.add(new VfsResource(vfsResource)); } }
@Override protected String getMatchingMapping(String pattern, HttpServletRequest request) { String lookupPath = this.pathHelper.getLookupPathForRequest(request); return this.pathMatcher.match(pattern, lookupPath) ? pattern : null; }
public boolean matches(Message<? extends Object> message) { if (!messageTypeMatcher.matches(message)) { return false; } String destination = SimpMessageHeaderAccessor.getDestination(message .getHeaders()); return destination != null && matcher.match(pattern, destination); }
@Override @Nullable public RequestMatchResult match(HttpServletRequest request, String pattern) { String lookupPath = getUrlPathHelper().getLookupPathForRequest(request); if (getPathMatcher().match(pattern, lookupPath)) { return new RequestMatchResult(pattern, lookupPath, getPathMatcher()); } else if (useTrailingSlashMatch()) { if (!pattern.endsWith("/") && getPathMatcher().match(pattern + "/", lookupPath)) { return new RequestMatchResult(pattern + "/", lookupPath, getPathMatcher()); } } return null; }
@Override protected String getMatchingMapping(String mapping, Message<?> message) { String destination = getLookupDestination(getDestination(message)); if (mapping.equals(destination) || this.pathMatcher.match(mapping, destination)) { return mapping; } return null; }
if (getPathMatcher().match(pattern, lookupPath)) { matchingPatterns.add(pattern);
public LinkedMultiValueMap<String, String> getSubscriptions(String destination, Message<?> message) { LinkedMultiValueMap<String, String> result = this.accessCache.get(destination); if (result == null) { synchronized (this.updateCache) { result = new LinkedMultiValueMap<>(); for (SessionSubscriptionInfo info : subscriptionRegistry.getAllSubscriptions()) { for (String destinationPattern : info.getDestinations()) { if (getPathMatcher().match(destinationPattern, destination)) { for (Subscription sub : info.getSubscriptions(destinationPattern)) { result.add(info.sessionId, sub.getId()); } } } } if (!result.isEmpty()) { this.updateCache.put(destination, result.deepCopy()); this.accessCache.put(destination, result); } } } return result; }