Package org.springframework.util

Examples of org.springframework.util.AntPathMatcher


  private boolean isAllowed(String resourcePath) {
    if (resourcePath.matches(PROTECTED_PATH)) {
      return false;
    }
    PathMatcher pathMatcher = new AntPathMatcher();
    for (String pattern : ALLOWED_RESOURCE_PATHS) {
      if (pathMatcher.match(pattern, resourcePath)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here


  private boolean isAllowed(String resourcePath) {
    if (resourcePath.matches(PROTECTED_PATH)) {
      return false;
    }
    PathMatcher pathMatcher = new AntPathMatcher();
    for (String pattern : allowedResourcePaths) {
      if (pathMatcher.match(pattern, resourcePath)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

    }

    protected List createResources(Element resourcesDefinition) {
        String dirName = resourcesDefinition.getAttribute(DIR_ATTR);
        final String pattern = resourcesDefinition.getAttribute(PATTERN_ATTR);
        final AntPathMatcher matcher = new AntPathMatcher();
        FileFilter filter = new FileFilter() {
            public boolean accept(File file) {
                return matcher.match(pattern, file.getName());
            }
        };
        List resources = new ArrayList();
        for (Iterator files = new FileIterator(dirName, filter); files.hasNext();) {
            File file = (File)files.next();
View Full Code Here

    private PathMatcher pathMatcher;

    public ValidationContextHandlerInterceptor() {
        validationContextUrlMappings = new ValidationContextUrlMapping[0];
        pathMatcher = new AntPathMatcher();
    }
View Full Code Here

    }

    protected List createResources(Element resourcesDefinition) {
        String dirName = resourcesDefinition.getAttribute(DIR_ATTR);
        final String pattern = resourcesDefinition.getAttribute(PATTERN_ATTR);
        final AntPathMatcher matcher = new AntPathMatcher();
        FileFilter filter = new FileFilter() {
            public boolean accept(File file) {
                return matcher.match(pattern, file.getName());
            }
        };
        List resources = new ArrayList();
        for (Iterator files = new FileIterator(dirName, filter); files.hasNext();) {
            File file = (File) files.next();
View Full Code Here

        message = MessageBuilder
                .withPayload("Hi")
                .setHeader(SimpMessageHeaderAccessor.DESTINATION_HEADER, "price.stock.1.2")
                .build();
        messages
                .pathMatcher(new AntPathMatcher("."))
                .antMatchers("price.stock.*").permitAll();

        assertThat(getAttribute()).isNull();

        message = MessageBuilder
                .withPayload("Hi")
                .setHeader(SimpMessageHeaderAccessor.DESTINATION_HEADER, "price.stock.1.2")
                .build();
        messages
                .pathMatcher(new AntPathMatcher("."))
                .antMatchers("price.stock.**").permitAll();

        assertThat(getAttribute()).isEqualTo("permitAll");
    }
View Full Code Here

                .withPayload("Hi")
                .setHeader(SimpMessageHeaderAccessor.DESTINATION_HEADER, "price.stock.1.2")
                .build();
        messages
                .antMatchers("price.stock.*").permitAll()
                .pathMatcher(new AntPathMatcher("."));

        assertThat(getAttribute()).isNull();

        message = MessageBuilder
                .withPayload("Hi")
                .setHeader(SimpMessageHeaderAccessor.DESTINATION_HEADER, "price.stock.1.2")
                .build();
        messages
                .antMatchers("price.stock.**").permitAll()
                .pathMatcher(new AntPathMatcher("."));

        assertThat(getAttribute()).isEqualTo("permitAll");
    }
View Full Code Here

     * @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());
    }
View Full Code Here

   * Default is AntPathMatcher.
   * @see #setAllowedResources
   * @see org.springframework.util.AntPathMatcher
   */
  protected PathMatcher getPathMatcher() {
    return new AntPathMatcher();
  }
View Full Code Here

      return response.getOutputStream();
    }
  }

  private boolean matchesCompressedMimeTypes(String mimeType) {
    PathMatcher pathMatcher = new AntPathMatcher();
    Iterator compressedMimeTypesIt = compressedMimeTypes.iterator();
    while (compressedMimeTypesIt.hasNext()) {
      String compressedMimeType = (String) compressedMimeTypesIt.next();
      if (pathMatcher.match(compressedMimeType, mimeType)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of org.springframework.util.AntPathMatcher

Copyright © 2018 www.massapicom. 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.