Examples of AntPathMatcher


Examples of org.springframework.util.AntPathMatcher

  public boolean matches(Saveable saveable, File file) {
    if (file == null) {
      return false;
    }
    String filePathRelativeToHudsonRoot = JenkinsFilesHelper.buildPathRelativeToHudsonRoot(file);
        AntPathMatcher matcher = new AntPathMatcher();
        for(String pattern : includesPatterns) {
            if(matcher.match(pattern, filePathRelativeToHudsonRoot)){
                return true;
            }
    }
    return false;
  }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

            final String path = (String) data[2];

            Assert.assertEquals(
                    "expects " + expected + " path '" + path + "' matches '" + pattern + "'",
                    expected,
                    new AntPathMatcher().match(pattern, path));
        }
    }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

            final String path = (String) data[2];

            Assert.assertEquals(
                    "expects " + expected + " path '" + path + "' matches '" + pattern + "'",
                    expected,
                    new AntPathMatcher().match(pattern, path));
        }
    }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

// Negative means we prefer the first argument when both patterns match
public class ReproTests {

  @Test
  public void patternComparatorWithHierarchicalMatchAccidentalPass() {
    Comparator<String> comparator = new AntPathMatcher().getPatternComparator("/hotels/new");
    // This passes accidentally: the order is correct but for the wrong reason
    assertTrue(comparator.compare("/hotels/{hotel}", "/hotels/**") < 0);
  }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

    assertTrue(comparator.compare("/hotels/{hotel}", "/hotels/**") < 0);
  }

  @Test
  public void patternComparatorWithHierarchicalMatchBracketsPreferred() {
    Comparator<String> comparator = new AntPathMatcher().getPatternComparator("/hotels/new/123");
    // This passes accidentally: the order is correct but for the wrong reason
    assertTrue(comparator.compare("/hotels/{hotel}/{booking}", "/hotels/**") < 0);
  }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

    assertTrue(comparator.compare("/hotels/{hotel}/{booking}", "/hotels/**") < 0);
  }

  @Test
  public void patternComparatorWithHierarchicalMatch() {
    Comparator<String> comparator = new AntPathMatcher().getPatternComparator("/hotels/new/123");
    // This fails, even though the first path is clearly more specific
    assertTrue(comparator.compare("/hotels/{hotel}/**", "/**") < 0);
  }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

    assertTrue(comparator.compare("/hotels/{hotel}/**", "/**") < 0);
  }

  @Test
  public void patternComparatorWithHierarchicalMatchWithWorkaround() {
    Comparator<String> comparator = new AntPathMatcher().getPatternComparator("/hotels/new/123");
    // This is a workaround
    assertTrue(comparator.compare("/hotels/{hotel}/**", "/**/**") < 0);
  }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

   * org.springframework.web.bind.support.WebDataBinderFactory)
   */
  @Override
  public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
          NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
    AntPathMatcher pathMatcher = new AntPathMatcher();
    RequestMapping requestMappingOnMethod = parameter.getMethodAnnotation(RequestMapping.class);
    RequestMapping requestMappingOnClass = getDeclaringClassRequestMapping(parameter);
    String combine = pathMatcher.combine(requestMappingOnClass.value()[0], requestMappingOnMethod.value()[0]);
    return PathUtils.removePrependedSlash(pathMatcher.extractPathWithinPattern(combine, (String) webRequest
        .getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE,
            NativeWebRequest.SCOPE_REQUEST)));
  }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

  @Override
  public void configureMessageBroker(MessageBrokerRegistry registry) {
    registry.enableSimpleBroker("/queue/", "/topic/");
//    registry.enableStompBrokerRelay("/queue/", "/topic/");
    registry.setApplicationDestinationPrefixes("/app");
    registry.setPathMatcher(new AntPathMatcher("."));
  }
View Full Code Here

Examples of org.springframework.util.AntPathMatcher

    // Given
    String pattern = "**/something";
    String path = "/one/two/three/something";

    // When
    String pathWithinPattern = new AntPathMatcher().extractPathWithinPattern(pattern, path);

    // Then
    assertEquals("/one/two/three/something", pathWithinPattern);
  }
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.