private boolean compilationAfterLazyCompilationRequred(
     Set<String> wildcardPatterns, String moduleName) {
   for (String pattern : wildcardPatterns) {
     if (wildcardPatternMatcher.match(pattern, moduleName)) {
       return true;
     }
   }
   return false;
 }
コード例 #2
0
  /**
   * Create a {@link UriComponentsBuilder} from the mapping of a controller method and an array of
   * method argument values. The array of values must match the signature of the controller method.
   * Values for {@code @RequestParam} and {@code @PathVariable} are used for building the URI (via
   * implementations of {@link org.springframework.web.method.support.UriComponentsContributor})
   * while remaining argument values are ignored and can be {@code null}.
   *
   * @param method the controller method
   * @param argumentValues argument values for the controller method
   * @return a UriComponentsBuilder instance, never {@code null}
   */
  public static UriComponentsBuilder fromMethod(Method method, Object... argumentValues) {
    String typePath = getTypeRequestMapping(method.getDeclaringClass());
    String methodPath = getMethodRequestMapping(method);
    String path = pathMatcher.combine(typePath, methodPath);

    UriComponentsBuilder builder =
        ServletUriComponentsBuilder.fromCurrentServletMapping().path(path);
    UriComponents uriComponents = applyContributors(builder, method, argumentValues);
    return ServletUriComponentsBuilder.newInstance().uriComponents(uriComponents);
  }
コード例 #3
0
 private boolean isExclude(final HttpServletRequest request) {
   if (excludeUrlPatterns == null) {
     return false;
   }
   for (String pattern : excludeUrlPatterns) {
     if (pathMatcher.match(pattern, request.getServletPath())) {
       return true;
     }
   }
   return false;
 }
コード例 #4
0
 public boolean matches(String lookup, PathMatcher mappingMatcher) {
   PathMatcher matcherToUse = (this.mappingMatcher != null) ? this.mappingMatcher : mappingMatcher;
   if (this.excludePatterns != null) {
     for (String pattern : this.excludePatterns) {
       if (matcherToUse.match(pattern, lookup)) {
         return false;
       }
     }
   }
   if (this.includePatterns == null) {
     return true;
   } else {
     for (String pattern : this.includePatterns) {
       if (matcherToUse.match(pattern, lookup)) {
         return true;
       }
     }
     return false;
   }
 }
コード例 #5
0
 Map<String, String> extractRequestParams(MockData mock, String urlPath) {
   String requestUrl = mock.getRequestUrl();
   int numberOfSlashesInMock = requestUrl.length() - requestUrl.replace("/", "").length();
   int numberOfSlashesInRequest = urlPath.length() - urlPath.replace("/", "").length();
   int delta = numberOfSlashesInRequest - numberOfSlashesInMock;
   urlPath =
       Stream.of(urlPath.split("/")) //
           .filter(part -> !Strings.isNullOrEmpty(part)) //
           .skip(delta) //
           .collect(Collectors.joining("/", "/", ""));
   return pathMatcher.extractUriTemplateVariables(requestUrl, urlPath);
 }
コード例 #6
0
 public static boolean matchAll(
     HttpServletRequest request,
     UrlPathHelper urlPathHelper,
     PathMatcher pathMatcher,
     String[] patterns) {
   if (ArrayUtils.isNotEmpty(patterns)) {
     String lookupPath = urlPathHelper.getLookupPathForRequest(request);
     for (String pattern : patterns) {
       if (!pathMatcher.match(pattern, lookupPath)) {
         return false;
       }
     }
   }
   return true;
 }
コード例 #7
0
ファイル: RegisteredServiceImpl.java プロジェクト: apetro/cas
 public boolean matches(final Service service) {
   return service != null
       && PATH_MATCHER.match(this.serviceId.toLowerCase(), service.getId().toLowerCase());
 }
コード例 #8
0
ファイル: ResourceDaoImpl.java プロジェクト: dagangwang/test
 private boolean urlMatcher(String sourcePatten, String requestUri) {
   boolean isMatcher = false;
   PathMatcher matcher = new AntPathMatcher();
   isMatcher = matcher.match(sourcePatten, requestUri);
   return isMatcher;
 }