Examples of PathMatcher


Examples of org.springframework.util.PathMatcher

    ResourceUrlProvider urlProvider = new ResourceUrlProvider();
    UrlPathHelper pathHelper = getPathMatchConfigurer().getUrlPathHelper();
    if (pathHelper != null) {
      urlProvider.setUrlPathHelper(pathHelper);
    }
    PathMatcher pathMatcher = getPathMatchConfigurer().getPathMatcher();
    if (pathMatcher != null) {
      urlProvider.setPathMatcher(pathMatcher);
    }
    return urlProvider;
  }
View Full Code Here

Examples of org.springframework.util.PathMatcher

    verifyWebInterceptor(interceptors.get(1), this.webInterceptor2);
  }

  @Test
  public void addInterceptorsWithCustomPathMatcher() {
    PathMatcher pathMatcher = Mockito.mock(PathMatcher.class);
    this.registry.addInterceptor(interceptor1).addPathPatterns("/path1/**").pathMatcher(pathMatcher);

    MappedInterceptor mappedInterceptor = (MappedInterceptor) this.registry.getInterceptors().get(0);
    assertSame(pathMatcher, mappedInterceptor.getPathMatcher());
  }
View Full Code Here

Examples of org.springframework.util.PathMatcher

    assertEquals(Collections.emptyList(), getInterceptorsForPath("/path1/secret"));
  }


  private List<HandlerInterceptor> getInterceptorsForPath(String lookupPath) {
    PathMatcher pathMatcher = new AntPathMatcher();
    List<HandlerInterceptor> result = new ArrayList<HandlerInterceptor>();
    for (Object interceptor : this.registry.getInterceptors()) {
      if (interceptor instanceof MappedInterceptor) {
        MappedInterceptor mappedInterceptor = (MappedInterceptor) interceptor;
        if (mappedInterceptor.matches(lookupPath, pathMatcher)) {
View Full Code Here

Examples of org.springframework.util.PathMatcher

  @Test
  public void defaultPathMatchConfiguration() throws Exception {
    ApplicationContext context = initContext(WebConfig.class);
    UrlPathHelper urlPathHelper = context.getBean(UrlPathHelper.class);
    PathMatcher pathMatcher = context.getBean(PathMatcher.class);

    assertNotNull(urlPathHelper);
    assertNotNull(pathMatcher);
    assertEquals(AntPathMatcher.class, pathMatcher.getClass());
  }
View Full Code Here

Examples of org.springframework.util.PathMatcher

    assertEquals("Only one custom converter is expected", 1, composite.getExceptionResolvers().size());
  }

  @Test
  public void configurePathMatch() throws Exception {
    final PathMatcher pathMatcher = mock(PathMatcher.class);
    final UrlPathHelper pathHelper = mock(UrlPathHelper.class);

    List<WebMvcConfigurer> configurers = new ArrayList<WebMvcConfigurer>();
    configurers.add(new WebMvcConfigurerAdapter() {
      @Override
View Full Code Here

Examples of org.springframework.util.PathMatcher

    List<HandlerMethodReturnValueHandler> returnValueHandlers = new ArrayList<HandlerMethodReturnValueHandler>();
    addReturnValueHandlers(returnValueHandlers);
    handler.setCustomReturnValueHandlers(returnValueHandlers);

    PathMatcher pathMatcher = this.getBrokerRegistry().getPathMatcher();
    if (pathMatcher != null) {
      handler.setPathMatcher(pathMatcher);
    }
    return handler;
  }
View Full Code Here

Examples of org.springframework.util.PathMatcher

    }
    if (typeLevelRequestMapping != null) {
      url += typeLevelRequestMapping.value()[0];
    }

    PathMatcher pathMatcher = this.context.getPathMatcher();
    if (pathMatcher == null) {
      pathMatcher = new AntPathMatcher();
    }
    url = pathMatcher.combine(url, methodRequestMapping.value()[0]);
    if (!url.startsWith("/")) {
      url = "/" + url;
    }
    return url;
  }
View Full Code Here

Examples of org.springframework.util.PathMatcher

  @Test
  public void shouldSupportContextSetters() throws Exception {
    WebArgumentResolver webArgumentResolver = mock(WebArgumentResolver.class);
    WebArgumentResolver[] customArgumentResolvers = new WebArgumentResolver[] { webArgumentResolver };
    PathMatcher pathMatcher = mock(PathMatcher.class);
    WebBindingInitializer webBindingInitializer = mock(WebBindingInitializer.class);
    ParameterNameDiscoverer parameterNameDiscoverer = mock(ParameterNameDiscoverer.class);
    this.resolver.setCustomArgumentResolvers(customArgumentResolvers);
    this.resolver.setPathMatcher(pathMatcher);
    this.resolver.setWebBindingInitializer(webBindingInitializer);
View Full Code Here

Examples of org.springframework.util.PathMatcher

      if (startsWithSlash) {
        pkg = FOLDER_SEPARATOR + pkg;
      }

      final PathMatcher matcher = getPathMatcher();
      // if the imported package matches the path
      if (matcher.matchStart(path, pkg)) {
        // start the JAR analysis
        Enumeration entries = importedBundle.getBundle().getEntryPaths(pkg);
        while (entries != null && entries.hasMoreElements()) {
          String entry = (String) entries.nextElement();
          if (startsWithSlash)
            entry = FOLDER_SEPARATOR + entry;

          if (matcher.match(path, entry)) {
            if (trace)
              logger.trace("Found entry [" + entry + "]");
            foundPaths.add(entry);
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.