Class AssetUrlMethodModel
java.lang.Object
org.apache.juneau.console.freemarker.AssetUrlMethodModel
- All Implemented Interfaces:
freemarker.template.TemplateMethodModel,freemarker.template.TemplateMethodModelEx,freemarker.template.TemplateModel
public final class AssetUrlMethodModel
extends Object
implements freemarker.template.TemplateMethodModelEx
The
assetUrl(path) FreeMarker method: appends ?v=<crc32> of an adopter's own bundled static asset
to its URL path, so a browser cannot keep a stale copy after a deploy.
Registered by ConsoleFreemarkerMixin when the builder is given
ConsoleFreemarkerMixin.Builder.adopterAssets(ClassLoader, String). The token is the same
CRC32 hash Juneau uses for its own assets, computed once per path and cached.
A path that already has a query string, is not context-root-absolute (e.g. an external URL), or names no bundled
resource is returned unchanged; the last case also logs a warning once per path when dev mode is on.
Example:
<script src="${assetUrl('/js/app.js')}"></script> <#-- /js/app.js?v=1a2b3c4d -->
- Since:
- 10.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe shared-variable name this method registers under.Fields inherited from interface freemarker.template.TemplateModel
NOTHING -
Method Summary
-
Field Details
-
NAME
The shared-variable name this method registers under.- See Also:
-
-
Method Details
-
exec
- Specified by:
execin interfacefreemarker.template.TemplateMethodModel- Specified by:
execin interfacefreemarker.template.TemplateMethodModelEx- Throws:
freemarker.template.TemplateModelException
-