public static Resource newResource ( URL url ) throws IOException { if ( url == null ) return null ; String urls = url . toExternalForm ( ) ; if ( urls . startsWith ( "file:" ) ) { try { FileResource fileResource = new FileResource ( url ) ; return fileResource ; } catch ( Exception e ) { log . debug ( LogSupport . EXCEPTION , e ) ; return new BadResource ( url , e . toString ( ) ) ; } } else if ( urls . startsWith ( "jar:file:" ) ) { return new JarFileResource ( url ) ; } else if ( urls . startsWith ( "jar:" ) ) { return new JarResource ( url ) ; } return new URLResource ( url , null ) ; }
Construct a resource from a url .