public static String normalizeResourcePath ( final String path ) { if ( path == null ) { return null ; } String normalizedPath = replaceSlashes ( path . trim ( ) ) ; if ( normalizedPath . startsWith ( "/" ) && normalizedPath . length ( ) > 1 ) { normalizedPath = normalizedPath . substring ( 1 ) ; } return normalizedPath ; }
Normalize the path for accesing a resource meaning that will replace consecutive slashes and will remove a leading slash if present .