public class WebJarAssetLocator extends Object
Modifier and Type | Field and Description |
---|---|
static String |
WEBJARS_PACKAGE
The webjar package name.
|
static String |
WEBJARS_PATH_PREFIX
The path to where webjar resources live.
|
Constructor and Description |
---|
WebJarAssetLocator()
Convenience constructor that will form a locator for all resources on the
current class path.
|
WebJarAssetLocator(Set<String> assetPaths) |
WebJarAssetLocator(SortedMap<String,String> fullPathIndex)
Establish a locator given an index that it should use.
|
Modifier and Type | Method and Description |
---|---|
String |
getFullPath(String partialPath)
Given a distinct path within the WebJar index passed in return the full
path of the resource.
|
String |
getFullPath(String webjar,
String partialPath)
Returns the full path of an asset within a specific WebJar
|
String |
getFullPathExact(String webjar,
String exactPath)
Returns the full path of an asset within a specific WebJar
|
SortedMap<String,String> |
getFullPathIndex() |
static SortedMap<String,String> |
getFullPathIndex(Pattern filterExpr,
ClassLoader... classLoaders)
Return a map that can be used to perform index lookups of partial file
paths.
|
static Map.Entry<String,String> |
getWebJar(String path) |
Map<String,String> |
getWebJars() |
Set<String> |
listAssets() |
Set<String> |
listAssets(String folderPath)
List assets within a folder.
|
public static final String WEBJARS_PACKAGE
public static final String WEBJARS_PATH_PREFIX
public WebJarAssetLocator()
public WebJarAssetLocator(SortedMap<String,String> fullPathIndex)
fullPathIndex
- the index to use.public static SortedMap<String,String> getFullPathIndex(Pattern filterExpr, ClassLoader... classLoaders)
filterExpr
- the regular expression to be used to filter resources that
will be included in the index.classLoaders
- the class loaders to be considered for loading the resources
from.public String getFullPath(String partialPath)
partialPath
- the path to return e.g. "jquery.js" or "abc/someother.js".
This must be a distinct path within the index passed in.public String getFullPath(String webjar, String partialPath)
webjar
- The id of the WebJar to searchpartialPath
- The partial path to look forpublic String getFullPathExact(String webjar, String exactPath)
webjar
- The id of the WebJar to searchexactPath
- The exact path of the file within the WebJarpublic Set<String> listAssets(String folderPath)
folderPath
- the root path to the folder.public Map<String,String> getWebJars()
Copyright © 2016. All rights reserved.