public static boolean isPathNameMatch ( String uri , String urlPattern ) { if ( urlPattern . startsWith ( "/" ) && urlPattern . endsWith ( "/*" ) ) { String s = urlPattern . substring ( 0 , urlPattern . length ( ) - 1 ) ; /** * First case,urlPattern * /a/b/c/ matches /a/b/c/* **/ if ( s . equalsIgnoreCase ( uri ) ) { return true ; } /** * Second case * /a/b/c matches /a/b/c/* **/ if ( uri . equalsIgnoreCase ( s . substring ( 0 , s . length ( ) - 1 ) ) ) { return true ; } /** * Third case * /a/b/c/d/e matches /a/b/c/* **/ if ( uri . startsWith ( s ) ) { return true ; } } return false ; }
Determine if the urlPattern is a path name match for the uri .