private RegisteredCommand searchCommands ( String cmdOwner , HttpMethod method , String uri , String query , Map < String , String > variableMap ) { Map < HttpMethod , SortedSet < RegisteredCommand > > evalMap = getCmdEvalMap ( cmdOwner ) ; if ( evalMap == null ) { return null ; } // Find the sorted command set for the given HTTP method. SortedSet < RegisteredCommand > cmdSet = evalMap . get ( method ) ; if ( cmdSet == null ) { return null ; } // Split uri into a list of non-empty nodes. List < String > pathNodeList = new ArrayList <> ( ) ; String [ ] pathNodes = uri . split ( "/" ) ; for ( String pathNode : pathNodes ) { if ( pathNode . length ( ) > 0 ) { pathNodeList . add ( pathNode ) ; } } // Attempt to match commands in this set in order. for ( RegisteredCommand cmd : cmdSet ) { if ( cmd . matches ( pathNodeList , query , variableMap ) ) { return cmd ; } } return null ; }
Search the given command owner for a matching command .