use of org.apache.tapestry5.internal.services.assets.ContextAssetRequestHandler in project tapestry-5 by apache.
the class AssetsModule method provideBuiltinAssetDispatchers.
/**
* Contributes an handler for each mapped classpath alias, as well handlers for context assets
* and stack assets (combined {@link org.apache.tapestry5.services.javascript.JavaScriptStack} files).
*/
@Contribute(Dispatcher.class)
@AssetRequestDispatcher
public static void provideBuiltinAssetDispatchers(MappedConfiguration<String, AssetRequestHandler> configuration, @ContextProvider AssetFactory contextAssetFactory, @Autobuild StackAssetRequestHandler stackAssetRequestHandler, ClasspathAssetAliasManager classpathAssetAliasManager, ResourceStreamer streamer, AssetSource assetSource, ClasspathAssetProtectionRule classpathAssetProtectionRule) {
Map<String, String> mappings = classpathAssetAliasManager.getMappings();
for (String folder : mappings.keySet()) {
String path = mappings.get(folder);
configuration.add(folder, new ClasspathAssetRequestHandler(streamer, assetSource, path, classpathAssetProtectionRule));
}
configuration.add(RequestConstants.CONTEXT_FOLDER, new ContextAssetRequestHandler(streamer, contextAssetFactory.getRootResource()));
configuration.add(RequestConstants.STACK_FOLDER, stackAssetRequestHandler);
}
Aggregations