ui/src/main/java/thredds/logs/PathMatcher.java
public Match match( String path) {
    SortedMap<String, Match> tail = treeMap.tailMap( path);
    if (tail.isEmpty()) return null;
    String after = tail.firstKey();
    //System.out.println("  "+path+"; after="+afterPath);
    if (path.startsWith( after)) // common case
      return treeMap.get( after);

    // have to check more, until no common starting chars
    for (String key : tail.keySet()) {
      if (path.startsWith(key))
        return treeMap.get(key);
      // terminate when there's no match at all.
      if (StringUtil2.match(path, key) == 0)
        break;
    }

    return null;
  }
public Match match( String path) {
    SortedMap<String, Match> tail = treeMap.tailMap( path);
    if (tail.isEmpty()) return null;
    String after = tail.firstKey();
    //System.out.println("  "+path+"; after="+afterPath);
    if (path.startsWith( after)) // common case
      return treeMap.get( after);

    // have to check more, until no common starting chars
    for (String key : tail.keySet()) {
      if (path.startsWith(key))
        return treeMap.get(key);
      // terminate when there's no match at all.
      if (StringUtil2.match(path, key) == 0)
        break;
    }

    return null;
  }
public Match match ( String path ) { SortedMap < String , Match > tail = treeMap . tailMap ( path ) ; if ( tail . isEmpty ( ) ) return null ; String after = tail . firstKey ( ) ; //System.out.println("  "+path+"; after="+afterPath);
 if ( path . startsWith ( after ) ) // common case
 return treeMap . get ( after ) ; // have to check more, until no common starting chars
 for ( String key : tail . keySet ( ) ) { if ( path . startsWith ( key ) ) return treeMap . get ( key ) ; // terminate when there's no match at all.
 if ( StringUtil2 . match ( path , key ) == 0 ) break ; } return null ; }
Find the longest match.
@param path find object with longest match where path.startsWith( key)
@return the value whose key is the longest that matches path, or null if none
Find the longest match .