public interface TagHandlerPlugin extends Plugin
<@bundle.js/@>
) to be replaced with arbitrary content.
Tag handlers are often used to cause the browser to make requests to a ContentPlugin
, typically using the
RoutableContentPlugin.getContentPathParser()
and ContentPathParser.createRequest(java.lang.String, java.lang.String...)
methods to help generate valid content paths. Similar to
ContentPlugin
instances, tag-handler plug-ins should be deterministic, in that they generate the same content each time they are run.
Although tag-handler plug-ins are designed to be usable both dynamically, and as part of a build (for flat-file export), a provision for generating different content in development and production is provided, for cases where things need to be done in a more efficient manner in production, and in a more dev-friendly manner in development. Developers that choose to exploit this facility should take care to ensure there is no chance of bugs being found in production, that can't also be observed in development; a core tenet of BladeRunnerJS.
The following methods are identifier-methods, and may be invoked before Plugin.setBRJS()
has been invoked:
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
getGeneratedContentPaths(java.util.Map<java.lang.String,java.lang.String> tagAttributes,
BundleSet bundleSet,
org.bladerunnerjs.model.RequestMode requestMode,
Locale locale)
Get a list of content paths this tag handler loads or causes the app to load.
|
java.lang.String |
getTagName()
Returns the name of the tag this tag-handler provides.
|
java.util.List<java.lang.String> |
usedContentPluginRequestPrefixes()
Returns the request prefixes this tag handler makes use of.
|
void |
writeTagContent(java.util.Map<java.lang.String,java.lang.String> tagAttributes,
BundleSet bundleSet,
org.bladerunnerjs.model.RequestMode requestMode,
Locale locale,
java.io.Writer writer,
java.lang.String version)
Writes out the generated content for the given tag, optimized for the specified request mode
|
castTo, close, getPluginClass, instanceOf, setBRJS
java.lang.String getTagName()
Note: Developers should not rely on any class initialization performed within Plugin.setBRJS()
as this
method is an identifier-method which may be invoked before Plugin.setBRJS()
has itself been
invoked.
void writeTagContent(java.util.Map<java.lang.String,java.lang.String> tagAttributes, BundleSet bundleSet, org.bladerunnerjs.model.RequestMode requestMode, Locale locale, java.io.Writer writer, java.lang.String version) throws java.io.IOException
tagAttributes
- TODObundleSet
- TODOrequestMode
- TODOlocale
- TODOwriter
- TODOversion
- TODOjava.io.IOException
- if any exceptions are thrown when writing the tag contentjava.util.List<java.lang.String> getGeneratedContentPaths(java.util.Map<java.lang.String,java.lang.String> tagAttributes, BundleSet bundleSet, org.bladerunnerjs.model.RequestMode requestMode, Locale locale) throws MalformedTokenException, ContentProcessingException
tagAttributes
- TODObundleSet
- TODOrequestMode
- TODOlocale
- TODOMalformedTokenException
- if the token cannot be processedContentProcessingException
- if an exception is encountered when generating the contentjava.util.List<java.lang.String> usedContentPluginRequestPrefixes()