congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PathMatcher
Code IndexAdd Tabnine to your IDE (free)

How to use
PathMatcher
in
leap.lang.path

Best Java code snippets using leap.lang.path.PathMatcher (Showing top 13 results out of 315)

origin: org.leapframework/leap-lang

@Override
public String extractRootDirPath(String location) {
  int prefixEnd = location.indexOf(":") + 1;
  int rootDirEnd = location.length();
  while (rootDirEnd > prefixEnd && getPathMatcher().isPattern(location.substring(prefixEnd, rootDirEnd))) {
    rootDirEnd = location.lastIndexOf('/', rootDirEnd - 2) + 1;
  }
  if (rootDirEnd == 0) {
    rootDirEnd = prefixEnd;
  }
  return location.substring(0, rootDirEnd);
}
origin: org.leapframework/leap-core

protected boolean matchPatterns(String path){
  for(int i=0;i<patterns.length;i++){
    if(patternMatcher.match(patterns[i], path)){
      return true;
    }
  }
  return false;
}

origin: org.leapframework/leap-lang

if (content.isDirectory() && getPathMatcher().matchStart(fullPattern, currPath + "/")) {
  if (!content.canRead()) {
    if (logger.isTraceEnabled()) {
if (getPathMatcher().match(fullPattern, currPath)) {
  result.add(content);
origin: org.leapframework/leap-core

  @Override
  public boolean matches(RequestBase request) {
    String path = request.getPath(ignoreCase);
    return isPattern ? matcher.match(pattern, path) : pattern.equals(path);
  }
}
origin: org.leapframework/leap-core

public PathPatternRequestMatcher(String path,PathMatcher matcher, boolean ignroeCase) {
  Args.notNull(path);
  Args.notNull(matcher);
  this.path       = path;
  this.matcher    = matcher;
  this.isPattern  = matcher.isPattern(path);
  this.ignoreCase = ignroeCase;
  this.pattern    = ignroeCase ? path.toLowerCase() : path;
}

origin: org.leapframework/leap-lang

public void visit(Object vfsResource) {
  String relativePath = VfsUtils.getPath(vfsResource).substring(this.rootPath.length());
  if (this.pathMatcher.match(this.subPattern,relativePath)) {
    this.resources.add(new VfsResource(vfsResource));
  }
}
origin: org.leapframework/leap-core

protected void parsePatterns(String patterns){
  if(!Strings.isEmpty(patterns)){
    if(ignoreCase){
      patterns = patterns.toLowerCase();
    }
    
    Set<String> set = new LinkedHashSet<String>();
    
    String[] lines = Strings.splitMultiLines(patterns);
    
    for(String line : lines){
      if(!Strings.isEmpty(line = line.trim())){
        if(!line.startsWith("/")){
          line = "/" + line;
        }
        
        if(!patternMatcher.isPattern(line)){
          throw new IllegalArgumentException("'" + line + "' is not a valid ant path pattern");
        }
        
        set.add(line);
      }
    }
    
    if(!set.isEmpty()){
      this.patterns = set.toArray(new String[set.size()]);
    }
  }
}
origin: org.leapframework/leap-lang

@Override
@SuppressWarnings("unchecked")
public ServletResource[] scan(String subPattern) {
  Args.notEmpty(subPattern,"subPattern");
  
  Set<String> subPaths = this.servletContext.getResourcePaths(this.path);
  
  List<SimpleServletResource> resources = new ArrayList<>();
  
  PathMatcher matcher = Resources.getPathMatcher();
  
  for(String subPath : subPaths){
    if(matcher.match(subPattern, subPath)){
      resources.add(new SimpleServletResource(servletContext, subPath));
    }
  }
  
  return resources.toArray(new SimpleServletResource[resources.size()]);
}
origin: org.leapframework/leap-lang

public Resource[] scan(String locationPattern) throws IOException {
  Args.notNull(locationPattern, "Location pattern");
  if (locationPattern.startsWith(Urls.CLASSPATH_ALL_URL_PREFIX)) {
    String locationPatternWithPrefix = locationPattern.substring(Urls.CLASSPATH_ALL_URL_PREFIX.length());
    
    // a class path resource (multiple resources for same name possible)
    if (getPathMatcher().isPattern(locationPatternWithPrefix)) {
      // a class path resource pattern
      return findPathMatchingResources(locationPattern);
    } else {
      // all class path resources with the given name
      return findAllClassPathResources(locationPatternWithPrefix);
    }
  } else {
    // Only look for a pattern after a prefix here
    // (to not get fooled by a pattern symbol in a strange prefix).
    int prefixEnd = locationPattern.indexOf(":") + 1;
    if (getPathMatcher().isPattern(locationPattern.substring(prefixEnd))) {
      // a file pattern
      return findPathMatchingResources(locationPattern);
    } else {
      // a single resource with the given name
      return new Resource[] {getResourceLoader().getResource(locationPattern)};
    }
  }
}
origin: org.leapframework/leap-lang

@Override
public Resource[] searchClasspaths(String... classpathPatterns) {
  Args.notNull(classpathPatterns,"classpath patterns");
  
  Set<Resource> resources = new LinkedHashSet<Resource>();
  
  for(String classpathPattern : classpathPatterns){
    if(classpathPattern.startsWith("/")){
      classpathPattern = classpathPattern.substring(1);
    }
    
    for(int i=0;i<values.length;i++){
      Resource resource = values[i];
      
      if(null != resource.getClasspath()){
        if(Resources.matcher.match(classpathPattern,resource.getClasspath())){
          resources.add(resource);
        }
      }
    }
  }
  
  return resources.toArray(new Resource[resources.size()]);
}

origin: org.leapframework/leap-lang

@Override
public Resource[] searchUrls(String... locationPatterns) {
  Args.notNull(locationPatterns,"location patterns");
  
  Set<Resource> resources = new LinkedHashSet<Resource>();
  
  for(String locationPattern : locationPatterns){
    try {
      for(int i=0;i<values.length;i++){
        Resource resource = values[i];
        
        if(Resources.matcher.match(locationPattern,resource.getURL().toExternalForm())){
          resources.add(resource);
        }
      }
    } catch (IOException e) {
      throw new NestedIOException(e);
    }
  }
  return resources.toArray(new Resource[resources.size()]);
}

origin: org.leapframework/leap-core

public AppResource[] searchResources(String[] patterns){
  Set<AppResource> set = new TreeSet<>(new ResourceComparator());
  final PathMatcher matcher = Resources.getPathMatcher();
  for(String namedPattern : patterns){
    if(namedPattern.startsWith("/")){
      namedPattern = namedPattern.substring(1);
    }
    for(AppResource r  : sortedResources) {
      if(null != r.getPath()) {
        String path = r.getPath();
        if(matcher.match(namedPattern, path)) {
          set.add(r);
        }
      }
    }
  }
  return set.toArray(new AppResource[0]);
}
origin: org.leapframework/leap-lang

if (entryPath.startsWith(rootEntryPath)) {
  String relativePath = entryPath.substring(rootEntryPath.length());
  if (getPathMatcher().match(subPattern, relativePath)) {
    result.add(rootDirResource.createRelative(relativePath));
leap.lang.pathPathMatcher

Most used methods

  • isPattern
  • match
  • matchStart

Popular in Java

  • Start an intent from android
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now