public class ModuleManagerImpl extends Object implements ModuleManager
| Constructor and Description |
|---|
ModuleManagerImpl(ResponseCompressionAnalyzer compressionAnalyzer,
AssetSource assetSource,
Map<String,JavaScriptModuleConfiguration> configuration,
Messages globalMessages,
StreamableResourceSource streamableResourceSource,
boolean compactJSON,
boolean productionMode,
String modulePathPrefix,
PathConstructor pathConstructor) |
| Modifier and Type | Method and Description |
|---|---|
Resource |
findResourceForModule(String moduleName)
Given a module name (which may be a path of names separated by slashes), locates the corresponding
Resource. |
void |
setupInvalidation(ResourceChangeTracker tracker) |
void |
writeConfiguration(Element body,
List<ModuleConfigurationCallback> callbacks)
Invoked by the internal
DocumentLinker service to write the configuration
for the module system into the page. |
void |
writeInitialization(Element body,
List<String> libraryURLs,
List<?> inits)
Invoked by the internal
DocumentLinker service to write the initializations
(as per JavaScriptSupport.require(String) into the page; this occurs after the module infrastructure
has been written into the page, along with the core libraries. |
public ModuleManagerImpl(ResponseCompressionAnalyzer compressionAnalyzer, AssetSource assetSource, Map<String,JavaScriptModuleConfiguration> configuration, Messages globalMessages, StreamableResourceSource streamableResourceSource, @Symbol(value="tapestry.compact-json") boolean compactJSON, @Symbol(value="tapestry.production-mode") boolean productionMode, @Symbol(value="tapestry.module-path-prefix") String modulePathPrefix, PathConstructor pathConstructor)
@PostInjection public void setupInvalidation(ResourceChangeTracker tracker)
public void writeConfiguration(Element body, List<ModuleConfigurationCallback> callbacks)
ModuleManagerDocumentLinker service to write the configuration
for the module system into the page.writeConfiguration in interface ModuleManagerbody - <body> element of the page, to which new <script> element(s) will be added.callbacks - a list of ModuleConfigurationCallbacks, which
is used to customize the configuration before it is written.public void writeInitialization(Element body, List<String> libraryURLs, List<?> inits)
ModuleManagerDocumentLinker service to write the initializations
(as per JavaScriptSupport.require(String) into the page; this occurs after the module infrastructure
has been written into the page, along with the core libraries.writeInitialization in interface ModuleManagerbody - <body> element of the page, to which new <script> element(s) will be added.libraryURLs - additional libraries that should be dynamically loaded before evaluating the initsinits - specify initialization on the page, based on loading modules, extacting functions from modules, and invoking those functionspublic Resource findResourceForModule(String moduleName)
ModuleManagerResource.
First checks for contributed shim modules, then searches for possible matches among the
defined library names. As a special
case, the folder name "app" is mapped to the application's package.findResourceForModule in interface ModuleManagermoduleName - name of module to locate5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.