Looks up (configuration) resources in JNDI or system environment.
@param resourceName
@return
435932
public static String lookup(String resourceName) {
        String resource = null;

        // 1. Check in the JNDI tree
        Context ctx = null;
        try {
            ctx = (Context) new InitialContext().lookup(JNDI_ENVIRONMENT);
            resource = (String) ctx.lookup(resourceName);
        }
        catch (NamingException ignore) {}

        // 2. Check among system properties
        if (null == resource || resource.length() == 0) {
            System.out.println("Resource \"" + resourceName + "\" not published through JNDI...");
            try {
                resource = System.getProperty(resourceName);
            }
            catch (Exception ignore) {}
        }

        if (null == resource || resource.length() == 0) {
            System.out.println("Resource \"" + resourceName + "\" not published through system properties...");
        }
        return resource;
    }
338056
public static String getExtension(String resourceName) {

        String result = null;
        if (!resourceName.endsWith("/")) {
            // folders don't have any extension
            resourceName = CmsResource.getName(resourceName);
            int index = resourceName.lastIndexOf(".") + 1;
            if ((index > 0) && (index < resourceName.length())) {
                result = resourceName.substring(index).toLowerCase();
            }
        }

        return result;
    }
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;
	}
1349276
public Resource getResource(String name, Locale locale) throws IOException {
        return getResource(name, locale, null);
    }
325936
public URL findResource(String fileName) {
		Object location = this.mixedResourceLocations.get(fileName);
		if (location == null) {
			return super.findResource(fileName);
		}
		String url;
		if (location instanceof File) {
			url = "file:/" + FileSupport.convertToUnixStylePath(((File) location).getAbsolutePath());
		} else {
			url = "jar:file:" + FileSupport.convertToUnixStylePath((String) location) + "!/" + fileName;
		}
		try {
			return new URL(url);
		} catch (MalformedURLException e) {
			throw new ResourceException(e);
		}
	}
713113
@Override
	public Reader getResource(String resourceName) throws ResourceNotFoundException {

		return getResource(null, resourceName, false);
	}
124026
public ResourceLookup getResourceLookup() {
        checkState(InitializedState.INITIALIZING, InitializedState.INITIALIZED);
        return new MultiResourceLookup(aggregatedModule.getResourceLookups());
    }
903249
public URL getResource(String resourceName, BeanContextChild child)
	{
		if (resourceName == null || child == null)
		{
			throw new NullPointerException();
		}
		if (!contains(child))
		{
			throw new IllegalArgumentException(Messages.getString("beans.6D"));
		}

		return ClassLoader.getSystemResource(resourceName);
	}
1278165
public static Reader resource(String resourceName) {
        if (resourceName == null) {
            throw new NullPointerException("'null' passed instead of resource name");
        }

        final InputStream resourceStream = ClassLoader.getSystemResourceAsStream(resourceName);
        if (resourceStream == null) {
            throw new IllegalArgumentException(format("resource '%s' not found", resourceName));
        }

        return new BufferedReader(new InputStreamReader(resourceStream));
    }
379330
public Resource getResource(String name, String encoding) throws IOException {
        return getResource(name, null, encoding);
    }
345696
def resource(self, name):
        
        for resource in self.resources():
            if resource.name.lower() == name.lower():
                return resource
        raise NotFound('Unable to find resource %s' % name)
245207
public Resource _getResource(String name) {
	Resource f = directory.getRealResource(name);
	if (f != null && f.exists() && f.isFile()) return f;
	return null;
    }
3461
public ResourceMetadata getResourceMetadata(String resourceName) {
    if (!resourceMetadataMap.containsKey(resourceName)) {
      throw new RuntimeException("No resource metadata for " + resourceName);
    }
    return resourceMetadataMap.get(resourceName);
  }
639492
public static synchronized File extractTessResources(String resourceName) {
        File targetPath = null;

        try {
            targetPath = new File(TESS4J_TEMP_DIR, resourceName);

            Enumeration<URL> resources = LoadLibs.class.getClassLoader().getResources(resourceName);
            while (resources.hasMoreElements()) {
                URL resourceUrl = resources.nextElement();
                copyResources(resourceUrl, targetPath);
            }
        } catch (IOException | URISyntaxException e) {
            logger.warn(e.getMessage(), e);
        }

        return targetPath;
    }
764983
@Override
    public Enumeration<URL> getResources(String name) throws IOException {
        if (this.rootClassLoader == null) {
            return findResources(name);
        }
        return new ResourceEnumeration(this.rootClassLoader.getResources(name),
                findResources(name));
    }
969821
@Override
   @SuppressWarnings("unchecked")
   protected Enumeration<URL> findResources(String name) {
      final List<Enumeration<URL>> enumerations = new ArrayList<>();

      for (WeakReference<Bundle> ref : bundles) {
         final Bundle bundle = ref.get();
         if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
            try {
               final Enumeration<URL> resources = bundle.getResources(name);
               if (resources != null) {
                  enumerations.add(resources);
               }
            } catch (Exception ignore) {
            }
         }
      }

      return new Enumeration<URL>() {

         @Override
         public boolean hasMoreElements() {
            for (Enumeration<URL> enumeration : enumerations) {
               if (enumeration != null && enumeration.hasMoreElements()) {
                  return true;
               }
            }
            return false;
         }

         @Override
         public URL nextElement() {
            for (Enumeration<URL> enumeration : enumerations) {
               if (enumeration != null && enumeration.hasMoreElements()) {
                  return enumeration.nextElement();
               }
            }
            throw new NoSuchElementException();
         }
      };
   }
179213
@Override
    public ICodeBaseEntry lookupResource(String resourceName) {

        // Translate resource name, in case a resource name
        // has been overridden and the resource is being accessed
        // using the overridden name.
        resourceName = translateResourceName(resourceName);
        if (!entries.contains(resourceName)) {
            return null;
        }

        try {
            ZipInputStreamCodeBaseEntry z = map.get(resourceName);
            if (z != null) {
                return z;
            }
            ZipInputStream zis = new ZipInputStream(new FileInputStream(file));
            try {
                ZipEntry ze;

                boolean found = false;
                int countDown = 20;
                while ((ze = zis.getNextEntry()) != null && countDown >= 0) {
                    if (ze.getName().equals(resourceName)) {
                        found = true;
                    }
                    if (found) {
                        countDown--;
                        if (map.containsKey(ze.getName())) {
                            continue;
                        }
                        z = build(zis, ze);
                        map.put(ze.getName(), z);
                    }
                    zis.closeEntry();
                }
            } finally {
                zis.close();
            }
            z = map.get(resourceName);
            if (z == null) {
                throw new AssertionError("Could not find " + resourceName);
            }
            return z;
        } catch (IOException e) {
            return null;
        }
    }