Returns the resource name extension if present.<p>
The extension will be always lower case.<p>

@param resourceName the resource name or path

@return the extension or <code>null</code> if not available
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;
    }
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();
    }
1183540
public static String getTarballResourceNameFromUrl(String url) {
        String resourceName = url.substring(url.lastIndexOf('/') + 1);
        return resourceName;
    }
1272670
private static String getExtension(String fileName) {
        // play it safe and get rid of any fragment id
        // that might be there
        int length = fileName.length();

        int newEnd = fileName.lastIndexOf('#');
        if (newEnd == -1) {
            newEnd = length;
        }
        int i = fileName.lastIndexOf('.', newEnd);
        if (i != -1) {
            return fileName.substring(i + 1, newEnd);
        } else {
            // no extension, no content type
            return null;
        }
    }
3461
public ResourceMetadata getResourceMetadata(String resourceName) {
    if (!resourceMetadataMap.containsKey(resourceName)) {
      throw new RuntimeException("No resource metadata for " + resourceName);
    }
    return resourceMetadataMap.get(resourceName);
  }
745981
public static ORule.ResourceGeneric getResourceGeneric(String name)
	{
		String shortName = Strings.beforeFirst(name, '.');
		if(Strings.isEmpty(shortName)) shortName = name;
		ORule.ResourceGeneric value = ORule.ResourceGeneric.valueOf(shortName);
		if(value==null) value = ORule.mapLegacyResourceToGenericResource(name);
		return value;
	}
827666
@Override
    public ICodeBaseEntry lookupResource(String resourceName) {
        if (!resourceName.equals(getResourceName())) {
            return null;
        }

        return new SingleFileCodeBaseEntry(this);
    }
905146
public ScriptEnvironment getEnvironmentForExtension(String extension) {
      Preconditions.checkArgument(StringUtils.isNotNullOrBlank(extension), "Extension name cannot be null or empty");
      return getEnvironment(getEnvironmentNameForExtension(extension));
   }
169871
public String getName() {
    ResourceServices services = getServices();
    return (services != null) ? services.getResourceName() : null;
  }
869000
public static String getClassName(Resource resource) {
        try {
            return getClassName(resource.getFile().getAbsolutePath());
        } catch (IOException e) {
            return null;
        }
    }
1140177
private String readResource(final String resourceName) throws IOException {
      return new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(resourceName), DEFAULT_CHARSET)).lines().collect(Collectors.joining("\n"));
   }
569230
public static ArchivePath getPathForClassloaderResource(String resourceName) {
        String extractedPath = null;
        if (resourceName.lastIndexOf('/') != -1) {
            extractedPath = resourceName.substring(0, resourceName.lastIndexOf('/'));
        }
        return new BasicPath(extractedPath);
    }
1271092
private ResourceType getResourceType(String resourceTag) {
        if (resourceTag == null || !resourceTag.endsWith("-resource")) {
            return ResourceType.unknown;
        }

        try {
            return ResourceType.valueOf(resourceTag.substring(0, resourceTag.length() - 9));
        } catch (Exception e) {
            return ResourceType.unknown;
        }
    }
1033309
private String getExtension(String fileName) {
		if (fileName == null) {
            return null;
        }

		String ext = null;
		int i = fileName.lastIndexOf('.');

		if (i > 0 && i < fileName.length() - 1) {
			ext = fileName.substring(i + 1).toLowerCase();
		}
		return ext;
	}
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));
    }
1048539
public static Xml readAllFromResource(String resourceName)  {
        InputStream is = XmlReader.class.getResourceAsStream(resourceName);
        XmlReader reader = new XmlReader(is);
        Xml xml = reader.read("node()");
        reader.close();
        return xml;
    }
671321
@Override
	public Set<String> getResourceNames(String dirName) {
		Set<String> resourceNames = new TreeSet<>();

		if (generatorRegistry.isPathGenerated(dirName)) {
			List<ResourceBrowser> browsers = new ArrayList<>();
			browsers.addAll(resourceGeneratorInfoProviders);
			for (ResourceBrowser rsBrowser : browsers) {

				if (rsBrowser instanceof ResourceGenerator) {
					ResourceGenerator rsGeneratorBrowser = (ResourceGenerator) rsBrowser;
					if (rsGeneratorBrowser.getResolver().matchPath(dirName)) {
						resourceNames.addAll(rsBrowser.getResourceNames(dirName));
						break;
					}
				}
			}
		} else {
			resourceNames = servletCtxResourceBrowser.getResourceNames(dirName);
		}

		return resourceNames;
	}