public final class ResourcePaths extends Object
Modifier and Type | Field and Description |
---|---|
static String |
EXTENSION_SEPARATOR
The extension separator, a period
. . |
static String |
PATH_SEPARATOR
The path separator, a forward slash
/ . |
Modifier and Type | Method and Description |
---|---|
static String |
addLeadingSlashIfNecessary(String resourcePath)
Add leading slash to given resource path if necessary.
|
static String |
addTrailingSlashIfNecessary(String resourcePath)
Add trailing slash to given resource path if necessary.
|
static String |
concat(String... resourcePaths)
Concat given resource paths with the path separator.
|
static Set<String> |
filterExtension(Set<String> resourcePaths)
Filters away every resource path in the given set that has an extension.
|
static String |
getExtension(String resourcePath)
Gets the extension of given resource path if any.
|
static boolean |
isDirectory(String resourcePath)
Checks if the given resource path obtained from
ServletContext.getResourcePaths(String) represents a directory. |
static boolean |
isExtensionless(String resourcePath)
Checks if given resource path is extensionless.
|
static boolean |
isRoot(String resourcePath)
Checks if the given resource path represents the root.
|
static String |
stripExtension(String resourcePath)
Strips the extension from the given resource path if any.
|
static String |
stripPrefixPath(String prefix,
String resourcePath)
Strips the given prefix from the given resource path if any.
|
static String |
stripTrailingSlash(String resourcePath)
Strips the trailing slash(es) from the given resource path if any.
|
public static final String PATH_SEPARATOR
/
.public static final String EXTENSION_SEPARATOR
.
.public static boolean isDirectory(String resourcePath)
ServletContext.getResourcePaths(String)
represents a directory. That is,
if it ends with "/".resourcePath
- The resource path to check.true
if the resource path represents a directory, false otherwise.public static String stripPrefixPath(String prefix, String resourcePath)
prefix
- The prefix to be stripped.resourcePath
- The resource path to strip the prefix from.public static String stripTrailingSlash(String resourcePath)
resourcePath
- The resource path to strip the trailing slash from.public static String stripExtension(String resourcePath)
resourcePath
- The resource path to strip the extension from.public static String getExtension(String resourcePath)
resourcePath
- The resource path to get the extension from.public static boolean isExtensionless(String resourcePath)
resourcePath
- The resource path to check.true
if the resource path is extensionless, false otherwise.public static Set<String> filterExtension(Set<String> resourcePaths)
resourcePaths
- A set of resource paths to be filteredpublic static boolean isRoot(String resourcePath)
resourcePath
- The resource path to check.true
if the resource path represents the root, false otherwise.public static String addLeadingSlashIfNecessary(String resourcePath)
resourcePath
- The resource paths to add leading slash to.public static String addTrailingSlashIfNecessary(String resourcePath)
resourcePath
- The resource paths to add trailing slash to.Copyright © 2012–2022 OmniFaces. All rights reserved.