public static URL getResource ( String resourceName , Class < ? > callingClass ) { URL url = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( resourceName ) ; if ( url == null ) { url = ClassLoaderUtil . class . getClassLoader ( ) . getResource ( resourceName ) ; } if ( url == null ) { ClassLoader cl = callingClass . getClassLoader ( ) ; if ( cl != null ) { url = cl . getResource ( resourceName ) ; } } if ( ( url == null ) && ( resourceName != null ) && ( ( resourceName . length ( ) == 0 ) || ( resourceName . charAt ( 0 ) != ' ' ) ) ) { return getResource ( ' ' + resourceName , callingClass ) ; } return url ; }
Load a given resource .