public static URL asUrlOrResource ( String s ) { if ( Strings . isNullOrEmpty ( s ) ) { return null ; } try { return new URL ( s ) ; } catch ( MalformedURLException e ) { //If its not a valid URL try to treat it as a local resource. return findConfigResource ( s ) ; } }
Convert a string to a URL and fallback to classpath resource if not convertible .