Case insensitive exact match.

@param path path to find descriptor for
@return path descriptor or null if not found
10822
public ConfigPath findByPath(final String path) {
        return paths.stream()
                .filter(it -> it.getPath().equalsIgnoreCase(path))
                .findFirst()
                .orElse(null);
    }
559435
public static String compactPath(String path) {
        if (path == null || path.length() == 0)
            return path;

        int state = 0;
        int end = path.length();
        int i = 0;

        loop:
        while (i < end) {
            char c = path.charAt(i);
            switch (c) {
                case '?':
                    return path;
                case '/':
                    state++;
                    if (state == 2)
                        break loop;
                    break;
                default:
                    state = 0;
            }
            i++;
        }

        if (state < 2)
            return path;

        StringBuilder buf = new StringBuilder(path.length());
        buf.append(path, 0, i);

        loop2:
        while (i < end) {
            char c = path.charAt(i);
            switch (c) {
                case '?':
                    buf.append(path, i, end);
                    break loop2;
                case '/':
                    if (state++ == 0)
                        buf.append(c);
                    break;
                default:
                    state = 0;
                    buf.append(c);
            }
            i++;
        }

        return buf.toString();
    }
894724
public Manifest findByPath(String path) {
        for (Manifest manifest : this) {
            String mpath = ((ManifestEx) manifest).path;

            if (path.startsWith(mpath)) {
                return manifest;
            }
        }

        return null;
    }
200450
public static boolean matchPath(String path, String pattern) {
		List<String> pathElements = PATH_SPLITTER.splitToList(path);
		List<String> patternElements = PATH_SPLITTER.splitToList(pattern);
		return matchTokens(pathElements.toArray(new String[0]), patternElements.toArray(new String[0]));
	}
166225
public static String asPath(String path) {
        if (path == null) {
            return null;
        }

        // On windows we have to replace the backslash
        if (!File.separator.equals(FileUtil.URI_SEPARATOR_CHAR)) {
            return path.replace(File.separator, FileUtil.URI_SEPARATOR_CHAR);
        } else {
            return path;
        }
    }
594232
def _MatchPath(self, pathspec, response):
    """"""
    to_match = response.pathspec.Basename()
    if pathspec.path_options == rdf_paths.PathSpec.Options.CASE_INSENSITIVE:
      return to_match.lower() == pathspec.path.lower()
    elif pathspec.path_options == rdf_paths.PathSpec.Options.CASE_LITERAL:
      return to_match == pathspec.path
    elif pathspec.path_options == rdf_paths.PathSpec.Options.REGEX:
      return bool(re.match(pathspec.path, to_match, flags=re.IGNORECASE))
    elif pathspec.path_options == rdf_paths.PathSpec.Options.RECURSIVE:
      return True
    raise ValueError("Unknown Pathspec type.")
671392
public boolean exactMatchExists(String path) {
        String _path = normalize(path);

        Iterator i = vHostTable.keySet().iterator();

        while (i.hasNext()) {
            try {
                String pattern = (String) i.next();
                // System.out.println("Pattern = "+pattern);
                if (_path.equals(pattern))
                    return true;
            } catch (Exception e) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught an exception in getMapping():", e);
                }
                return false;
            }
        }

        return false;
    }
875699
public static boolean isPathNameMatch(String uri, String urlPattern) {
        if (urlPattern.startsWith("/") && urlPattern.endsWith("/*")) {
            String s = urlPattern.substring(0, urlPattern.length() - 1);
            /**
             * First case,urlPattern
             * /a/b/c/ matches /a/b/c/*
             **/
            if (s.equalsIgnoreCase(uri)) {
                return true;
            }
            /**
             * Second case
             * /a/b/c matches /a/b/c/*
             **/
            if (uri.equalsIgnoreCase(s.substring(0, s.length() - 1))) {
                return true;
            }

            /**
             * Third case
             * /a/b/c/d/e matches /a/b/c/*
             **/
            if (uri.startsWith(s)) {
                return true;
            }
        }

        return false;
    }
31447
static boolean matchPath(String[] tokenizedPattern, String[] strDirs, boolean isCaseSensitive) {
        int patIdxStart = 0;
        int patIdxEnd = tokenizedPattern.length - 1;
        int strIdxStart = 0;
        int strIdxEnd = strDirs.length - 1;

        // up to first '**'
        while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
            String patDir = tokenizedPattern[patIdxStart];
            if (patDir.equals(DEEP_TREE_MATCH)) {
                break;
            }
            if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {
                return false;
            }
            patIdxStart++;
            strIdxStart++;
        }
        if (strIdxStart > strIdxEnd) {
            // String is exhausted
            for (int i = patIdxStart; i <= patIdxEnd; i++) {
                if (!tokenizedPattern[i].equals(DEEP_TREE_MATCH)) {
                    return false;
                }
            }
            return true;
        } else {
            if (patIdxStart > patIdxEnd) {
                // String not exhausted, but pattern is. Failure.
                return false;
            }
        }

        // up to last '**'
        while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
            String patDir = tokenizedPattern[patIdxEnd];
            if (patDir.equals(DEEP_TREE_MATCH)) {
                break;
            }
            if (!match(patDir, strDirs[strIdxEnd], isCaseSensitive)) {
                return false;
            }
            patIdxEnd--;
            strIdxEnd--;
        }
        if (strIdxStart > strIdxEnd) {
            // String is exhausted
            for (int i = patIdxStart; i <= patIdxEnd; i++) {
                if (!tokenizedPattern[i].equals(DEEP_TREE_MATCH)) {
                    return false;
                }
            }
            return true;
        }

        while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {
            int patIdxTmp = -1;
            for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {
                if (tokenizedPattern[i].equals(DEEP_TREE_MATCH)) {
                    patIdxTmp = i;
                    break;
                }
            }
            if (patIdxTmp == patIdxStart + 1) {
                // '**/**' situation, so skip one
                patIdxStart++;
                continue;
            }
            // Find the pattern between padIdxStart & padIdxTmp in str between
            // strIdxStart & strIdxEnd
            int patLength = (patIdxTmp - patIdxStart - 1);
            int strLength = (strIdxEnd - strIdxStart + 1);
            int foundIdx = -1;
            strLoop:
            for (int i = 0; i <= strLength - patLength; i++) {
                for (int j = 0; j < patLength; j++) {
                    String subPat = tokenizedPattern[patIdxStart + j + 1];
                    String subStr = strDirs[strIdxStart + i + j];
                    if (!match(subPat, subStr, isCaseSensitive)) {
                        continue strLoop;
                    }
                }

                foundIdx = strIdxStart + i;
                break;
            }

            if (foundIdx == -1) {
                return false;
            }

            patIdxStart = patIdxTmp;
            strIdxStart = foundIdx + patLength;
        }

        for (int i = patIdxStart; i <= patIdxEnd; i++) {
            if (!tokenizedPattern[i].equals(DEEP_TREE_MATCH)) {
                return false;
            }
        }

        return true;
    }
62998
public static boolean checkIsPathOrLinkToSvg(String path) {

        if (path == null) {
            return false;
        }
        path = path.trim().toLowerCase();
        int paramPos = path.indexOf("?");
        if (paramPos >= 0) {
            path = path.substring(0, paramPos);
        }
        return path.endsWith(".svg");
    }
1197321
def match(self, path_pattern):
        
        cf = self._flavour.casefold
        path_pattern = cf(path_pattern)
        drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
        if not pat_parts:
            raise ValueError("empty pattern")
        if drv and drv != cf(self._drv):
            return False
        if root and root != cf(self._root):
            return False
        parts = self._cparts
        if drv or root:
            if len(pat_parts) != len(parts):
                return False
            pat_parts = pat_parts[1:]
        elif len(pat_parts) > len(parts):
            return False
        for part, pat in zip(reversed(parts), reversed(pat_parts)):
            if not fnmatch.fnmatchcase(part, pat):
                return False
        return True
1004368
public static String convertToUnixStylePath(String path) {
		String retval = StringSupport.replaceAll(path, "\\", "/");
		retval = StringSupport.replaceAll(retval, new String[]{"///", "//"}, new String[]{"/", "/"});
		return retval;
	}
536519
protected String getLocalePath (String path)
    {
        return (_localeHandler == null) ? null : _localeHandler.getLocalePath(path);
    }
358223
PathMatcher.PathMatch<HostEntry> match(String path){
        int length = path.length();
        final int[] lengths = this.lengths;
        for (int i = 0; i < lengths.length; ++i) {
            int pathLength = lengths[i];
            if (pathLength == length) {
                HostEntry next = contexts.get(path);
                if (next != null) {
                    return new PathMatcher.PathMatch<>(path, "", next);
                }
            } else if (pathLength < length) {
                char c = path.charAt(pathLength);
                if (c == '/') {
                    String part = path.substring(0, pathLength);
                    HostEntry next = contexts.get(part);
                    if (next != null) {
                        return new PathMatcher.PathMatch<>(part, path.substring(pathLength), next);
                    }
                }
            }
        }
        if(defaultHandler.contexts.isEmpty()) {
            return new PathMatcher.PathMatch<>("", path, null);
        }
        return new PathMatcher.PathMatch<>("", path, defaultHandler);
    }
20819
def may_contain_matches(self, path):
        
        path = self._prepare_path(path)
        return self.int_regex.search(path) is not None
67618
public List getMatches(String path)
    {        
        Map.Entry entry;
        Object entries=null;

        if (path==null)
            return LazyList.getList(entries);
        
        int l=path.indexOf(';');
        if (l<0)
        {
            l=path.indexOf('?');
            if (l<0)
                l=path.length();
        }

        // try exact match
        entry=_exactMap.getEntry(path,0,l);
        if (entry!=null)
            entries=LazyList.add(entries,entry.getValue());
        
        // prefix search
        int i=l-1;
        while((i=path.lastIndexOf('/',i-1))>=0)
        {
            entry=_prefixMap.getEntry(path,0,i);
            if (entry!=null)
                entries=LazyList.add(entries,entry.getValue());
        }
        
        // Prefix Default
        if (_prefixDefault!=null)
            entries=LazyList.add(entries,_prefixDefault);
        
        // Extension search
        i=0;
        while ((i=path.indexOf('.',i+1))>0)
        {
            entry=_suffixMap.getEntry(path,i+1,l-i-1);
            if (entry!=null)
                entries=LazyList.add(entries,entry.getValue());
        }

        // Default
        if (_default!=null)
        {
            // Optimization for just the default
            if (entries==null)
                return _defaultSingletonList;
            
            entries=LazyList.add(entries,_default);
        }
        
        return LazyList.getList(entries);
    }
600554
protected void checkPath(Path path) {
    URI uri = path.toUri();
    if (uri.getScheme() == null)                // fs is relative 
      return;
    String thisScheme = this.getUri().getScheme();
    String thatScheme = uri.getScheme();
    String thisAuthority = this.getUri().getAuthority();
    String thatAuthority = uri.getAuthority();
    //authority and scheme are not case sensitive
    if (thisScheme.equalsIgnoreCase(thatScheme)) {// schemes match
      if (thisAuthority == thatAuthority ||       // & authorities match
          (thisAuthority != null && 
           thisAuthority.equalsIgnoreCase(thatAuthority)))
        return;

      if (thatAuthority == null &&                // path's authority is null
          thisAuthority != null) {                // fs has an authority
        URI defaultUri = getDefaultUri(getConf()); // & is the conf default 
        if (thisScheme.equalsIgnoreCase(defaultUri.getScheme()) &&
            thisAuthority.equalsIgnoreCase(defaultUri.getAuthority()))
          return;
        try {                                     // or the default fs's uri
          defaultUri = get(getConf()).getUri();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        if (thisScheme.equalsIgnoreCase(defaultUri.getScheme()) &&
            thisAuthority.equalsIgnoreCase(defaultUri.getAuthority()))
          return;
      }
    }
    throw new IllegalArgumentException("Wrong FS: "+path+
                                       ", expected: "+this.getUri());
  }