Package org.webjars
Class WebJarAssetLocator
java.lang.Object
org.webjars.WebJarAssetLocator
Locate WebJar assets. The class is thread safe.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<String,
WebJarAssetLocator.WebJarInfo> static final String
The webjar package name.static final String
The path to where webjar resources live. -
Constructor Summary
ConstructorDescriptionWebJarAssetLocator
(io.github.classgraph.ClassGraph classGraph) WebJarAssetLocator
(ClassLoader classLoader) WebJarAssetLocator
(ClassLoader classLoader, String... whitelistPaths) WebJarAssetLocator
(String... whitelistPaths) WebJarAssetLocator
(Map<String, WebJarAssetLocator.WebJarInfo> allWebJars) -
Method Summary
Modifier and TypeMethodDescriptionprotected static Map<String,
WebJarAssetLocator.WebJarInfo> findWebJars
(io.github.classgraph.ScanResult scanResult) getFullPath
(String partialPath) Given a distinct path within the WebJar index passed in return the full path of the resource.getFullPath
(String webjar, String partialPath) Returns the full path of an asset within a specific WebJargetFullPathExact
(String webJarName, String exactPath) Returns the full path of an asset within a specific WebJargetWebJar
(CharSequence path) Gets the Group ID given a fullPathlistAssets
(String folderPath) List assets within a folder.protected static io.github.classgraph.ResourceList
webJarResources
(String webJarName, io.github.classgraph.ResourceList resources) protected static String
webJarVersion
(String webJarName, io.github.classgraph.ResourceList resources)
-
Field Details
-
WEBJARS_PACKAGE
The webjar package name.- See Also:
-
WEBJARS_PATH_PREFIX
The path to where webjar resources live.- See Also:
-
allWebJars
-
-
Constructor Details
-
WebJarAssetLocator
public WebJarAssetLocator() -
WebJarAssetLocator
-
WebJarAssetLocator
-
WebJarAssetLocator
-
WebJarAssetLocator
public WebJarAssetLocator(io.github.classgraph.ClassGraph classGraph) -
WebJarAssetLocator
-
-
Method Details
-
getAllWebJars
-
webJarResources
-
webJarVersion
-
findWebJars
@Nonnull protected static Map<String,WebJarAssetLocator.WebJarInfo> findWebJars(@Nonnull io.github.classgraph.ScanResult scanResult) -
getWebJar
- Parameters:
path
- The full WebJar path (notnull
)- Returns:
- A WebJar tuple (Entry) with key = id and value = version or
null
if not a legal WebJar file format
-
getFullPath
Given a distinct path within the WebJar index passed in return the full path of the resource.- Parameters:
partialPath
- the path to return e.g. "jquery.js" or "abc/someother.js". This must be a distinct path within the index passed in (notnull
or empty).- Returns:
- a fully qualified path to the resource.
-
getFullPath
Returns the full path of an asset within a specific WebJar- Parameters:
webjar
- The id of the WebJar to search (notnull
partialPath
- The partial path to look for (notnull
- Returns:
- a fully qualified path to the resource
- Throws:
NotFoundException
- if webjar or path not found
-
getFullPathExact
Returns the full path of an asset within a specific WebJar- Parameters:
webJarName
- The id of the WebJar to search (must not benull
exactPath
- The exact path of the file within the WebJar (may benull
for legacy reasons)- Returns:
- a fully qualified path to the resource of
null
if WebJar not found
-
listAssets
-
listAssets
List assets within a folder.- Parameters:
folderPath
- the root path to the folder.- Returns:
- a set of folder paths that match.
-
getWebJars
- Returns:
- A map of the WebJars based on the files in the CLASSPATH where the key is the artifactId and the value is the version
-
groupId
Gets the Group ID given a fullPath- Parameters:
fullPath
- the fullPath to the asset in a WebJar, i.e. META-INF/resources/webjars/jquery/2.1.0/jquery.js- Returns:
- the Group ID for the WebJar or
null
if it can't be determined
-