Spring Framework AntPathMatcher - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework AntPathMatcher class.

This code example shows how to use the following methods:
	} 
 
	@Test
	public void prependSlashWithCustomPathSeparator() { 
		DestinationPatternsMessageCondition c =
				new DestinationPatternsMessageCondition(new String[] {"foo"}, new AntPathMatcher("."));
 
		assertEquals("Pre-pending should be disabled when not using '/' as path separator", 
				"foo", c.getPatterns().iterator().next());
	} 
 
	// SPR-8255 
 
	@Test
	public void prependNonEmptyPatternsOnly() { 
		DestinationPatternsMessageCondition c = condition("");
		assertEquals("", c.getPatterns().iterator().next());
	} 
 
	@Test
6
CodeRank
This code example shows how to use the following methods:
public class PropertiesMethodNameResolver extends AbstractUrlMethodNameResolver 
		implements InitializingBean { 
 
	private Properties mappings; 
 
	private PathMatcher pathMatcher = new AntPathMatcher(); 
 
 
	/** 
	 * Set explicit URL to method name mappings through a Properties object. 
	 * @param mappings Properties with URL as key and method name as value 
	 */ 
	public void setMappings(Properties mappings) { 
		this.mappings = mappings; 
	} 
 
	/** 
	 * Set the PathMatcher implementation to use for matching URL paths 
	 * against registered URL patterns. Default is AntPathMatcher. 
	 * @see org.springframework.util.AntPathMatcher 
6
CodeRank
This code example shows how to use the following methods:
 
	private static class MyHandlerMethodMapping extends AbstractHandlerMethodMapping<String> { 
 
		private UrlPathHelper pathHelper = new UrlPathHelper(); 
 
		private PathMatcher pathMatcher = new AntPathMatcher(); 
 
		@Override 
		protected String getMatchingMapping(String pattern, HttpServletRequest request) { 
			String lookupPath = pathHelper.getLookupPathForRequest(request); 
			return pathMatcher.match(pattern, lookupPath) ? pattern : null; 
		} 
 
		@Override 
		protected String getMappingForMethod(Method method, Class<?> handlerType) { 
			String methodName = method.getName(); 
			return methodName.startsWith("handler") ? methodName : null; 
		} 
 
		@Override 
6
CodeRank
This code example shows how to use the following methods:
 * @author Rick Evans 
 * @since 14.09.2005 
 */ 
public class UrlFilenameViewControllerTests extends TestCase { 
 
	private PathMatcher pathMatcher = new AntPathMatcher(); 
 
 
	public void testWithPlainFilename() throws Exception { 
		UrlFilenameViewController ctrl = new UrlFilenameViewController(); 
		MockHttpServletRequest request = new MockHttpServletRequest("GET", "/index"); 
		MockHttpServletResponse response = new MockHttpServletResponse(); 
		ModelAndView mv = ctrl.handleRequest(request, response); 
		assertEquals("index", mv.getViewName()); 
		assertTrue(mv.getModel().isEmpty()); 
	} 
 
	public void testWithFilenamePlusExtension() throws Exception { 
		UrlFilenameViewController ctrl = new UrlFilenameViewController(); 
		MockHttpServletRequest request = new MockHttpServletRequest("GET", "/index.html"); 
6
CodeRank
This code example shows how to use the following methods:
 * @since 1.5.0 
 * @created 22 Sep 2012 
 */ 
public class ConfigurableAntPathPatternsResourceAuthorizationManager 
    implements ResourceAuthorizationManager { 
  private final AntPathMatcher matcher = new AntPathMatcher();
  private List<String> patterns = new ArrayList<String>();
 
  @Override 
  public boolean isAuthorized(final String uri) {
    for (final String pattern : patterns) {
      if (matcher.match(pattern, WroUtil.removeQueryString(uri))) {
        return true; 
      } 
    } 
    return false; 
  } 
 
  /** 
   * @param list set a list of authorized patterns 
6
CodeRank
This code example shows how to use the following methods:
	@Override 
	public void configureMessageBroker(MessageBrokerRegistry registry) { 
		registry.enableSimpleBroker("/queue/", "/topic/"); 
//		registry.enableStompBrokerRelay("/queue/", "/topic/"); 
		registry.setApplicationDestinationPrefixes("/app"); 
		registry.setPathMatcher(new AntPathMatcher(".")); 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:
 
	private UrlPathHelper urlPathHelper = new UrlPathHelper(); 
 
	private Map<String, Integer> cacheMappings = new HashMap<String, Integer>(); 
 
	private PathMatcher pathMatcher = new AntPathMatcher(); 
 
 
	public WebContentInterceptor() { 
		// no restriction of HTTP methods by default, 
		// in particular for use with annotated controllers 
		super(false); 
	} 
 
 
	/** 
	 * Set if URL lookup should always use full path within current servlet 
	 * context. Else, the path within the current servlet mapping is used 
	 * if applicable (i.e. in the case of a ".../*" servlet mapping in web.xml). 
	 * Default is "false". 
6
CodeRank
This code example shows how to use the following methods:
	public DestinationPatternsMessageCondition(String[] patterns, PathMatcher pathMatcher) {
		this(asList(patterns), pathMatcher);
	} 
 
	private DestinationPatternsMessageCondition(Collection<String> patterns, PathMatcher pathMatcher) {
		this.pathMatcher = (pathMatcher != null ? pathMatcher : new AntPathMatcher());
		this.patterns = Collections.unmodifiableSet(prependLeadingSlash(patterns, this.pathMatcher));
	} 
 
 
	private static List<String> asList(String... patterns) {
		return (patterns != null ? Arrays.asList(patterns) : Collections.<String>emptyList());
	} 
 
	private static Set<String> prependLeadingSlash(Collection<String> patterns, PathMatcher pathMatcher) {
		if (patterns == null) {
			return Collections.emptySet();
		} 
		boolean slashSeparator = pathMatcher.combine("a", "a").equals("a/a");
		Set<String> result = new LinkedHashSet<String>(patterns.size());
6
CodeRank
This code example shows how to use the following methods:
 * @see org.springframework.integration.file.filters.AbstractRegexPatternFileListFilter 
 * @since 2.0 
 */ 
public abstract class AbstractSimplePatternFileListFilter<F> extends AbstractFileListFilter<F> { 
 
	private final AntPathMatcher matcher = new AntPathMatcher();
 
	private final String path;
 
 
	public AbstractSimplePatternFileListFilter(String path) {
		this.path = path;
	} 
 
 
	/** 
	 * Accepts the given file if its name matches the pattern. 
	 */ 
	@Override 
	public final boolean accept(F file) {
6
CodeRank
This code example shows how to use the following methods:
     * @param pattern the pattern to use 
     * @param type the {@link SimpMessageType} to match on or null if any {@link SimpMessageType} should be matched. 
     * @param pathMatcher the {@link PathMatcher} to use. 
     */ 
    public SimpDestinationMessageMatcher(String pattern, SimpMessageType type) {
        this(pattern, null, new AntPathMatcher());
    } 
 
    /** 
     * <p> 
     * Creates a new instance with the specified pattern, {@link SimpMessageType}, and {@link PathMatcher}. 
     * </p> 
     * 
     * @param pattern the pattern to use 
     * @param type the {@link SimpMessageType} to match on or null if any {@link SimpMessageType} should be matched. 
     * @param pathMatcher the {@link PathMatcher} to use. 
     */ 
    public SimpDestinationMessageMatcher(String pattern, SimpMessageType type, PathMatcher pathMatcher) {
        Assert.notNull(pattern, "pattern cannot be null");
        Assert.notNull(pathMatcher, "pathMatcher cannot be null");
6
CodeRank
See Code Examples for Spring Framework AntPathMatcher Methods: