private static boolean startsWith ( String requestPath , String pathComponent ) { if ( requestPath . charAt ( 0 ) != ' ' ) { return false ; } int i = 1 ; for ( int j = 0 ; i < requestPath . length ( ) ; ++ i , ++ j ) { if ( requestPath . charAt ( i ) == ' ' ) { return j == pathComponent . length ( ) ; } if ( j == pathComponent . length ( ) ) { return false ; } if ( Character . toLowerCase ( requestPath . charAt ( i ) ) != Character . toLowerCase ( pathComponent . charAt ( j ) ) ) { return false ; } } return false ; }
Test if request path starts with path component . This predicate returns true if first path component from given request path equals requested path component . Comparison is not case sensitive . Request path should start with path separator otherwise this predicate returns false .