lib/espresso/dispatchRequest.js
function(urls, skipMissing) {
        var i = -1;
        var j;
        var handlers = [];
        var url;
        var resource;

        var urlsLength = urls.length;
        var resourcesLength = this._resources.length;
        var foundHandler;

        // All URLs
        while( ++i < urlsLength ) {
            url = urls[i];
            foundHandler = undefined;   // No handler yet

            j = -1;
            // All resources
            while( ++j < resourcesLength ) {
                resource = this._resources[j];

                if( ! resource.getPattern().matches(url) )
                    continue;

                // If this handler does not want to use cascading
                // we remove every handler that might have been executed
                // before it
                if( false === resource.getOption('cascading') )
                    handlers = [];

                handlers.push({ path: url, handler: resource });
                foundHandler = resource;
                break;
            }

            // One handler missing? Chain is broken, return an error if required
            if( _.isUndefined(foundHandler) && ! skipMissing )
                return null;
        }


        return handlers;
    }
function(urls, skipMissing) {
        var i = -1;
        var j;
        var handlers = [];
        var url;
        var resource;

        var urlsLength = urls.length;
        var resourcesLength = this._resources.length;
        var foundHandler;

        // All URLs
        while( ++i < urlsLength ) {
            url = urls[i];
            foundHandler = undefined;   // No handler yet

            j = -1;
            // All resources
            while( ++j < resourcesLength ) {
                resource = this._resources[j];

                if( ! resource.getPattern().matches(url) )
                    continue;

                // If this handler does not want to use cascading
                // we remove every handler that might have been executed
                // before it
                if( false === resource.getOption('cascading') )
                    handlers = [];

                handlers.push({ path: url, handler: resource });
                foundHandler = resource;
                break;
            }

            // One handler missing? Chain is broken, return an error if required
            if( _.isUndefined(foundHandler) && ! skipMissing )
                return null;
        }


        return handlers;
    }
function ( urls , skipMissing ) { var i = - 1 ; var j ; var handlers = [ ] ; var url ; var resource ; var urlsLength = urls . length ; var resourcesLength = this . _resources . length ; var foundHandler ; // All URLs while ( ++ i < urlsLength ) { url = urls [ i ] ; foundHandler = undefined ; // No handler yet j = - 1 ; // All resources while ( ++ j < resourcesLength ) { resource = this . _resources [ j ] ; if ( ! resource . getPattern ( ) . matches ( url ) ) continue ; // If this handler does not want to use cascading // we remove every handler that might have been executed // before it if ( false === resource . getOption ( 'cascading' ) ) handlers = [ ] ; handlers . push ( { path : url , handler : resource } ) ; foundHandler = resource ; break ; } // One handler missing? Chain is broken, return an error if required if ( _ . isUndefined ( foundHandler ) && ! skipMissing ) return null ; } return handlers ; }
Finds all handlers for the given URLs.
If `skipMissing` is `false`, `null` will be returned
if a handler was not found.

this = api$this

@param {array}   urls    List of URLs to handle
@param {boolean} skipMissing Skip missing "holes"?
Finds all handlers for the given URLs . If skipMissing is false null will be returned if a handler was not found .