Package ru.vyarus.guicey.gsp.app.asset
Class AssetSources
java.lang.Object
ru.vyarus.guicey.gsp.app.asset.AssetSources
Application classpath resources configuration object. Assets may be merged from multiple classpath locations.
Moreover, classpath locations could be mapped to exact urls.
If assets available only through custom class loader then it must be specified, otherwise application class loader would be used (and, most likely, will not find required resources).
- Since:
- 28.11.2019
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClassLoaderDefault class loader used for assets loading. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister one root asset location.voidattach(String location, ClassLoader loader) Same asattach(String)but with custom class loader to use for assets loading.voidRegister location for exact url path (path-mapped locations override root mappings too).voidattach(String url, String location, ClassLoader loader) Same asattach(String, String)but with custom class loader to use for assets loading.com.google.common.collect.Multimap<String,ClassLoader> NOTE: default loader (DEFAULT_LOADER) will be registered for each package.voidmerge(AssetSources assets) Merge assets configurations (in-app config with global extensions).
-
Field Details
-
DEFAULT_LOADER
Default class loader used for assets loading.
-
-
Constructor Details
-
AssetSources
public AssetSources()
-
-
Method Details
-
attach
Register one root asset location.- Parameters:
location- asset classpath location
-
attach
Register location for exact url path (path-mapped locations override root mappings too).Internally, path used without first slash to simplify matching. Location could be declared as pure package ('dot' separated path).
- Parameters:
url- sub urllocation- asset classpath location
-
attach
Same asattach(String)but with custom class loader to use for assets loading.WARNING: only freemarker could see templates from this loader and only if support activated
ServerPagesBundle.ViewsBuilder.enableFreemarkerCustomClassLoadersSupport()- Parameters:
location- asset classpath locationloader- class loader to use for assets loading (may be null to use default)
-
attach
Same asattach(String, String)but with custom class loader to use for assets loading.WARNING: only freemarker could see templates from this loader and only if support activated
ServerPagesBundle.ViewsBuilder.enableFreemarkerCustomClassLoadersSupport()- Parameters:
url- sub urllocation- assets classpath locationloader- class loader to use for assets loading (may be null to use default)
-
getLocations
- Returns:
- configured assets classpath locations by url
-
getLoaders
NOTE: default loader (DEFAULT_LOADER) will be registered for each package. No duplicates are possible.- Returns:
- configured class loaders for packages
-
merge
Merge assets configurations (in-app config with global extensions).- Parameters:
assets- other assets configuration
-