public static URL findConfigResource ( String resourceName ) { if ( Strings . isNullOrEmpty ( resourceName ) ) { return null ; } final URL url = resourceName . startsWith ( ROOT ) ? DefaultConfiguration . class . getResource ( resourceName ) : DefaultConfiguration . class . getResource ( ROOT + resourceName ) ; if ( url != null ) { return url ; } // This is useful to get resource under META-INF directory String [ ] resourceNamePrefix = new String [ ] { "META-INF/fabric8/" , "META-INF/fabric8/" } ; for ( String resource : resourceNamePrefix ) { String fullResourceName = resource + resourceName ; URL candidate = KubernetesResourceLocator . class . getResource ( fullResourceName . startsWith ( ROOT ) ? fullResourceName : ROOT + fullResourceName ) ; if ( candidate != null ) { return candidate ; } } return null ; }
Returns the URL of a classpath resource .