Returns the URL of a classpath resource.

@param resourceName
The name of the resource.

@return The URL.
332037
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;
    }
1179417
protected final Optional<URL> defaultGetResource(String name) {
        return Optional.ofNullable(getClassLoader().getResource(name));
    }
1331507
protected ResourceHandle getClassHandle(final String name)
    {
        String path = name.replace('.', '/').concat(".class");
        return getResourceHandle(path);
    }
108244
public static @CheckForNull URL _findResource(ClassLoader cl, String name) {
        return (URL) invoke(FIND_RESOURCE, RuntimeException.class, cl, name);
    }
855599
public URL getResource(final String name) {
		final String normalizedName = Path.normalizeResourcePath(rootPath
				+ (name.startsWith("/") ? "" : "/") + name).trim();

		log.debug("Searching bundle " + bundle
						+ " for resource [{}], normalized to [{}]", name,
				normalizedName);

		URL url = resourceCache.get(normalizedName);

		if (url == null && !normalizedName.isEmpty()) {
			url = bundle.getEntry(normalizedName);
			if (url == null) {
				log.debug("getEntry failed, trying with /META-INF/resources/ in bundle class space");
				// Search attached bundles for web-fragments
				Set<Bundle> bundlesInClassSpace = ClassPathUtil.getBundlesInClassSpace(bundle, new HashSet<>());
				for (Bundle bundleInClassSpace : bundlesInClassSpace) {
					url = bundleInClassSpace.getEntry("/META-INF/resources/" + normalizedName);
					if (url != null) {
						break;
					}
				}
			}
			// obviously still not found might be available from a attached bundle resource
			if (url == null) {
				log.debug("getEntry failed, fallback to getResource");
				url = bundle.getResource(normalizedName);
			}
			if (url == null) {
				url = NO_URL;
			}
			resourceCache.putIfAbsent(normalizedName, url);
		}

		if (url != null && url != NO_URL) {
			log.debug("Resource found as url [{}]", url);
		} else {
			log.debug("Resource not found");
			url = null;
		}
		return url;
	}
695316
public static String getPathForResource(final String resourcePath) {
        URL path = ResourceUtil.class.getResource(resourcePath);
        if (path == null) {
            path = ResourceUtil.class.getResource("/");
            File tmpFile = new File(path.getPath(), resourcePath);
            return tmpFile.getPath();
        }

        return path.getPath();
    }
626600
@Override
    public Collection<URL> getResources(String resName)
    {
        try
        {
            return new EnumerationList<URL>(delegate.getResources(resName));
        } catch (IOException e)
        {
            throw new ResourceLoadingException(Tr.formatMessage(tc,
                                                                "error.loading.resource.CWOWB1005E",
                                                                resName
                            ), e);

        }
    }
590991
@Nullable
  public URL getResource (final String name)
  {
    URL ret = null;

    if (m_aBestCandidate != null)
    {
      ret = m_aBestCandidate.getResource (name);
      if (ret != null)
        return ret;
      m_aBestCandidate = null;
    }

    IClassLoadHelper aLoadHelper = null;

    final Iterator <IClassLoadHelper> iter = m_aLoadHelpers.iterator ();
    while (iter.hasNext ())
    {
      aLoadHelper = iter.next ();
      ret = aLoadHelper.getResource (name);
      if (ret != null)
        break;
    }

    m_aBestCandidate = aLoadHelper;
    return ret;
  }
538302
@Override
	public String getFilePath(String resourcePath) {
		String path = getResolver().getResourcePath(resourcePath);
		return rsBrowser.getFilePath(path);
	}
1231825
private static File _getClassSource (final String className)
  {
    if (className != null)
    {
      final String classResource = className.replace ('.', '/') + ".class";
      return _getResourceSource (classResource, Thread.currentThread ().getContextClassLoader ());
    }
    return null;
  }
133766
public static String getResourceUri(String resourceName) {

        StringBuffer result = new StringBuffer(256);
        result.append(getSkinUri());
        result.append(resourceName);
        return result.toString();
    }
624503
@Override
	public String getResourcePath(String requestedPath) {
		String resourcePath = super.getResourcePath(requestedPath);
		GeneratorMappingHelper helper = new GeneratorMappingHelper(resourcePath);
		String fullPath = null;
		if (StringUtils.isNotEmpty(helper.getBracketsParam())) {
			// Use the webjars reference stored in the bracket params
			fullPath = locator.getFullPath(helper.getBracketsParam(), helper.getPath());
		} else {
			fullPath = locator.getFullPath(resourcePath);
		}
		if (checkResourcePathForInfo || checkResourcePathForWarning) {
			checkResourcePath(resourcePath, fullPath);
		}
		return fullPath.substring(GeneratorRegistry.WEBJARS_GENERATOR_HELPER_PREFIX.length() - 2);
	}
470668
@Override
	public String getFilePath(String resourcePath) {

		String filePath = null;
		String path = getCompletePath(resourcePath);
		URL url = null;
		try {
			url = ClassLoaderResourceUtils.getResourceURL(path, this);
			String strURL = url.toString();
			if (strURL.startsWith(JawrConstant.FILE_URL_PREFIX)) {
				filePath = new File(url.getFile()).getAbsolutePath();
			} else if (strURL.startsWith(JawrConstant.JAR_URL_PREFIX + JawrConstant.FILE_URL_PREFIX)) {
				String tmp = strURL.substring((JawrConstant.JAR_URL_PREFIX + JawrConstant.FILE_URL_PREFIX).length());
				int idxJarContentSeparator = tmp.indexOf("!");
				if (idxJarContentSeparator != -1) {
					tmp = tmp.substring(0, idxJarContentSeparator);
				}
				filePath = new File(tmp).getAbsolutePath();
			}
		} catch (ResourceNotFoundException e) {
			filePath = null;
		}

		return filePath;
	}
31553
public static File getClasspathFile(String filename) {
    if(filename == null) {
      throw LOG.nullParameter("filename");
    }

    return getClasspathFile(filename, null);
  }
6710
public URL getResourceURL(String filepath, URL urlCodeBase, String version, ClassLoader classLoader) throws RuntimeException
    {
        if (filepath == null)
            return null;
        if (File.separatorChar != '/')
            filepath = filepath.replace(File.separatorChar, '/'); // Just in case I get a window's path

        boolean isResource = true;
        if (urlCodeBase != null)
        	if ("file".equalsIgnoreCase(urlCodeBase.getProtocol()))
        		isResource = false;
        URL url = null;
        try {
        	if (isResource)
        		if (classLoader != null)
        		{
        			url = classLoader.getResource(filepath);
        			if (url == null)
        			    if (filepath.startsWith("/"))
        			        url = classLoader.getResource(filepath.substring(1));    // Classpaths shouldn't start with root
        		}
        } catch (Exception e) {
            // Keep trying
        }

        if (url == null)
        {
        	if (isResource)
        		if (this.getClassFinder(null) != null)
        			url = this.getClassFinder(null).findResourceURL(filepath, version);	// Try to find this class in the obr repos
        }

        if (url == null)
        {
            try
            {
                if (urlCodeBase != null)
                    url = new URL(urlCodeBase, filepath);
            } catch(MalformedURLException ex) {
                // Keep trying
            } catch (Exception e) {
                // Keep trying
            }
        }
        return url;
    }
560510
def get_resource_url(self):
        

        name = self.__class__.resource_name
        url = self.__class__.rest_base_url()

        return "%s/%s" % (url, name)
820804
@Override
    public URL getResource( String path )
    {
        URL url = null;
        if ( baseLoader != null )
            // classloader wants no leading slash
            url = baseLoader.getResource( path.substring(1) );
        if ( url == null )
            url = super.getResource( path );
        return url;
    }