private boolean uriMatch ( String requestURI , IFilterMapping fmInfo , DispatcherType dispatcherType ) { boolean theyMatch = false ; // determine what type of filter uri we have switch ( fmInfo . getMappingType ( ) ) { case FMI_MAPPING_SINGLE_SLASH : // default servlet mapping...if requestURI is "/", they match if ( requestURI . equals ( "/" ) ) // 144908 theyMatch = true ; break ; case FMI_MAPPING_PATH_MATCH : // it's a path mapping...match string is already stripped if ( requestURI . startsWith ( fmInfo . getUrlPattern ( ) + "/" ) || requestURI . equals ( fmInfo . getUrlPattern ( ) ) ) theyMatch = true ; break ; case FMI_MAPPING_EXTENSION_MATCH : // it's an extension mapping...get the extension String ext = fmInfo . getUrlPattern ( ) . substring ( 2 ) ; // compare to any extension on the request uri int index = requestURI . lastIndexOf ( ' ' ) ; if ( index != - 1 ) if ( ext . equals ( requestURI . substring ( index + 1 ) ) ) theyMatch = true ; break ; case FMI_MAPPING_EXACT_MATCH : // it's an exact match if ( requestURI . equals ( fmInfo . getUrlPattern ( ) ) ) theyMatch = true ; break ; default : // should never happen...give a message? break ; } // Check if dispatch mode matches boolean dispMatch = false ; if ( theyMatch ) { for ( int i = 0 ; i < fmInfo . getDispatchMode ( ) . length ; i ++ ) { if ( dispatcherType == fmInfo . getDispatchMode ( ) [ i ] ) { dispMatch = true ; break ; } } } return dispMatch && theyMatch ; }
Compares the request uri to the passed in filter uri to see if the filter associated with the filter uri should filter the request uri