question: String findFirstMatchingKey ( T container , String url ) { String tUrl = url . contains ( "?" ) ? url . substring ( 0 , url . indexOf ( '?' ) ) : url ; int index = - 1 ; while ( ( index = tUrl . lastIndexOf ( '/' ) ) > - 1 ) { if ( containsKey ( container , tUrl ) ) { return tUrl ; } tUrl = tUrl . substring ( 0 , index ) ; } return url . startsWith ( "/" ) && containsKey ( container , "/" ) ? "/" : null ; }
target:  Searches in the given container for the first matching key (url pattern) for the given url.<br /> The search is performend up - down (first /a/b/c/d, ..., last /a ).