protected boolean matches ( String requestUri , ControllerPath controllerPath , HttpMethod httpMethod ) throws ClassLoadException { boolean match = false ; String [ ] requestUriSegments = Util . split ( requestUri , ' ' ) ; if ( isWildcard ( ) && requestUriSegments . length >= segments . size ( ) && wildSegmentsMatch ( requestUriSegments , controllerPath ) ) { String [ ] tailArr = Arrays . copyOfRange ( requestUriSegments , segments . size ( ) - 1 , requestUriSegments . length ) ; wildCardValue = Util . join ( tailArr , "/" ) ; match = true ; } else if ( segments . isEmpty ( ) && requestUri . equals ( "/" ) ) { //this is matching root path: "/" actionName = "index" ; match = true ; } else if ( requestUriSegments . length < mandatorySegmentCount || requestUriSegments . length > segments . size ( ) && controllerPath . getControllerPackage ( ) == null ) { //route("/greeting/{user_id}").to(HelloController.class).action("hi"); match = false ; //keep here for clarity } else { if ( segments . size ( ) != requestUriSegments . length ) { return false ; } //there should be a more elegant way ... for ( int i = 0 ; i < segments . size ( ) ; i ++ ) { String requestUriSegment = requestUriSegments [ i ] ; match = segments . get ( i ) . match ( requestUriSegment , controllerPath ) ; if ( ! match ) break ; } } if ( match && Configuration . activeReload ( ) ) { controller = reloadController ( ) ; } return match && methodMatches ( httpMethod ) ; }
Returns true if this route matches the request URI otherwise returns false .