@ NonNull private List < Mapping > getMappings ( String httpPath ) { List < Mapping > returned = new ArrayList <> ( ) ; List < Path . Segment > httpSegments = Path . pathToList ( httpPath ) ; Map < Mapping , RequestHandler > mappings = getMappingMap ( ) ; for ( Mapping mapping : mappings . keySet ( ) ) { List < Path . Rule > paths = mapping . getPath ( ) . getRuleList ( ) ; for ( Path . Rule path : paths ) { List < Path . Segment > segments = path . getSegments ( ) ; if ( httpSegments . size ( ) != segments . size ( ) ) continue ; String pathStr = Path . listToPath ( segments ) ; if ( pathStr . equals ( httpPath ) ) { returned . add ( mapping ) ; break ; // Validate next mapping. } boolean matches = true ; for ( int i = 0 ; i < segments . size ( ) ; i ++ ) { Path . Segment segment = segments . get ( i ) ; if ( ! segment . equals ( httpSegments . get ( i ) ) && ! segment . isBlurred ( ) ) { matches = false ; break ; } } if ( matches ) returned . add ( mapping ) ; } } return returned ; }
Get the mapping corresponding to the path .