public HttpHandler findHandler ( Class handlerClass , String uri , String [ ] vhosts ) { uri = URI . stripPath ( uri ) ; if ( vhosts == null || vhosts . length == 0 ) vhosts = __noVirtualHost ; for ( int h = 0 ; h < vhosts . length ; h ++ ) { String host = vhosts [ h ] ; PathMap contextMap = ( PathMap ) _virtualHostMap . get ( host ) ; if ( contextMap != null ) { List contextLists = contextMap . getMatches ( uri ) ; if ( contextLists != null ) { for ( int i = 0 ; i < contextLists . size ( ) ; i ++ ) { Map . Entry entry = ( Map . Entry ) contextLists . get ( i ) ; List contextList = ( List ) entry . getValue ( ) ; for ( int j = 0 ; j < contextList . size ( ) ; j ++ ) { HttpContext context = ( HttpContext ) contextList . get ( j ) ; HttpHandler handler = context . getHandler ( handlerClass ) ; if ( handler != null ) return handler ; } } } } } return null ; }
Find handler . Find a handler for a URI . This method is provided for the servlet context getContext method to search for another context by URI . A list of hosts may be passed to qualify the search .