Package org.apache.tapestry5.modules
Class AssetsModule
- java.lang.Object
-
- org.apache.tapestry5.modules.AssetsModule
-
@Marker(Core.class) public class AssetsModule extends Object
- Since:
- 5.3
-
-
Constructor Summary
Constructors Constructor Description AssetsModule()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addApplicationAndTapestryMappings(MappedConfiguration<String,String> configuration, String appPackage)
static void
addMappingsForLibraryVirtualFolders(MappedConfiguration<String,String> configuration, ComponentClassResolver resolver)
static void
bind(ServiceBinder binder)
static ClasspathAssetProtectionRule
buildClasspathAssetProtectionRule(List<ClasspathAssetProtectionRule> rules, ChainBuilder chainBuilder)
static AssetFactory
buildContextAssetFactory(ApplicationGlobals globals, AssetPathConstructor assetPathConstructor, ResponseCompressionAnalyzer compressionAnalyzer, ResourceChangeTracker resourceChangeTracker, StreamableResourceSource streamableResourceSource)
void
configureStandardAssetFactories(MappedConfiguration<String,AssetFactory> configuration, AssetFactory contextAssetFactory, AssetFactory classpathAssetFactory)
static void
contributeClasspathAssetProtectionRule(OrderedConfiguration<ClasspathAssetProtectionRule> configuration)
void
disableCompressionForImageTypes(MappedConfiguration<String,Boolean> configuration)
Disables compression for the following content types: image/jpeg image/gif image/png image/svg+xml application/x-shockwave-flash application/font-woff application/x-font-ttf application/vnd.ms-fontobjectStreamableResourceSource
enableCompressedCaching(StreamableResourceSource delegate, boolean gzipEnabled, ResourceChangeTracker tracker)
StreamableResourceSource
enableCompression(StreamableResourceSource delegate, boolean gzipEnabled, int compressionCutoff, AssetChecksumGenerator checksumGenerator)
StreamableResourceSource
enableCSSURLRewriting(StreamableResourceSource delegate, OperationTracker tracker, AssetSource assetSource, AssetChecksumGenerator checksumGenerator, boolean strictCssUrlRewriting)
StreamableResourceSource
enableMinification(StreamableResourceSource delegate, ResourceMinimizer minimizer, boolean enabled)
StreamableResourceSource
enableUncompressedCaching(StreamableResourceSource delegate, ResourceChangeTracker tracker)
static void
provideBuiltinAssetDispatchers(MappedConfiguration<String,AssetRequestHandler> configuration, AssetFactory contextAssetFactory, StackAssetRequestHandler stackAssetRequestHandler, ClasspathAssetAliasManager classpathAssetAliasManager, ResourceStreamer streamer, AssetSource assetSource, ClasspathAssetProtectionRule classpathAssetProtectionRule)
Contributes an handler for each mapped classpath alias, as well handlers for context assets and stack assets (combinedJavaScriptStack
files).static void
setupAssetDispatch(OrderedConfiguration<Dispatcher> configuration, Dispatcher assetDispatcher)
void
setupDefaultContentTypeMappings(MappedConfiguration<String,String> configuration)
Adds content types: css text/css js text/javascript jpg, jpeg image/jpeg gif image/gif png image/png svg image/svg+xml swf application/x-shockwave-flash woff application/font-woff tff application/x-font-ttf eot application/vnd.ms-fontobjectStreamableResourceSource
setupDisableMinificationByJavaScriptStack(StreamableResourceSource delegate, boolean enabled, JavaScriptStackSource javaScriptStackSource, Request request)
static void
setupGlobalMessageCatalog(AssetSource assetSource, Resource applicationCatalog, OrderedConfiguration<Resource> configuration)
Contributes: ClientLocalization A virtual resource of formatting symbols for decimal numbers Core Built in messages used by Tapestry's default validators and components AppCatalog The Resource defined bySymbolConstants.APPLICATION_CATALOG
static void
setupSymbols(MappedConfiguration<String,Object> configuration)
StreamableResourceSource
setupTextAssetsAsUTF8(StreamableResourceSource delegate)
Ensures that all "text/*" assets are given the UTF-8 charset.
-
-
-
Constructor Detail
-
AssetsModule
public AssetsModule()
-
-
Method Detail
-
bind
public static void bind(ServiceBinder binder)
-
configureStandardAssetFactories
@Contribute(AssetSource.class) public void configureStandardAssetFactories(MappedConfiguration<String,AssetFactory> configuration, @ContextProvider AssetFactory contextAssetFactory, @ClasspathProvider AssetFactory classpathAssetFactory)
-
setupSymbols
@Contribute(SymbolProvider.class) @FactoryDefaults public static void setupSymbols(MappedConfiguration<String,Object> configuration)
-
enableCompression
@Decorate(id="GZipCompression", serviceInterface=StreamableResourceSource.class) public StreamableResourceSource enableCompression(StreamableResourceSource delegate, @Symbol("tapestry.gzip-compression-enabled") boolean gzipEnabled, @Symbol("tapestry.min-gzip-size") int compressionCutoff, AssetChecksumGenerator checksumGenerator)
-
enableCompressedCaching
@Decorate(id="CacheCompressed", serviceInterface=StreamableResourceSource.class) @Order("before:GZIpCompression") public StreamableResourceSource enableCompressedCaching(StreamableResourceSource delegate, @Symbol("tapestry.gzip-compression-enabled") boolean gzipEnabled, ResourceChangeTracker tracker)
-
enableUncompressedCaching
@Decorate(id="Cache", serviceInterface=StreamableResourceSource.class) @Order("after:GZipCompression") public StreamableResourceSource enableUncompressedCaching(StreamableResourceSource delegate, ResourceChangeTracker tracker)
-
enableMinification
@Decorate(id="Minification", serviceInterface=StreamableResourceSource.class) @Order("after:Cache,TextUTF8") public StreamableResourceSource enableMinification(StreamableResourceSource delegate, ResourceMinimizer minimizer, @Symbol("tapestry.enable-minification") boolean enabled)
-
enableCSSURLRewriting
@Decorate(id="CSSURLRewrite", serviceInterface=StreamableResourceSource.class) @Order("after:Minification") public StreamableResourceSource enableCSSURLRewriting(StreamableResourceSource delegate, OperationTracker tracker, AssetSource assetSource, AssetChecksumGenerator checksumGenerator, @Symbol("tapestry.strict-css-url-rewriting") boolean strictCssUrlRewriting)
-
setupDisableMinificationByJavaScriptStack
@Decorate(id="DisableMinificationForStacks", serviceInterface=StreamableResourceSource.class) @Order("before:Minification") public StreamableResourceSource setupDisableMinificationByJavaScriptStack(StreamableResourceSource delegate, @Symbol("tapestry.enable-minification") boolean enabled, JavaScriptStackSource javaScriptStackSource, Request request)
-
setupTextAssetsAsUTF8
@Decorate(id="TextUTF8", serviceInterface=StreamableResourceSource.class) @Order("after:Cache") public StreamableResourceSource setupTextAssetsAsUTF8(StreamableResourceSource delegate)
Ensures that all "text/*" assets are given the UTF-8 charset.- Since:
- 5.4
-
setupDefaultContentTypeMappings
@Contribute(ContentTypeAnalyzer.class) public void setupDefaultContentTypeMappings(MappedConfiguration<String,String> configuration)
Adds content types:- css
- text/css
- js
- text/javascript
- jpg, jpeg
- image/jpeg
- gif
- image/gif
- png
- image/png
- svg
- image/svg+xml
- swf
- application/x-shockwave-flash
- woff
- application/font-woff
- tff
- application/x-font-ttf
- eot
- application/vnd.ms-fontobject
-
disableCompressionForImageTypes
@Contribute(CompressionAnalyzer.class) public void disableCompressionForImageTypes(MappedConfiguration<String,Boolean> configuration)
Disables compression for the following content types:- image/jpeg
- image/gif
- image/png
- image/svg+xml
- application/x-shockwave-flash
- application/font-woff
- application/x-font-ttf
- application/vnd.ms-fontobject
-
buildContextAssetFactory
@Marker(ContextProvider.class) public static AssetFactory buildContextAssetFactory(ApplicationGlobals globals, AssetPathConstructor assetPathConstructor, ResponseCompressionAnalyzer compressionAnalyzer, ResourceChangeTracker resourceChangeTracker, StreamableResourceSource streamableResourceSource)
-
addApplicationAndTapestryMappings
@Contribute(ClasspathAssetAliasManager.class) public static void addApplicationAndTapestryMappings(MappedConfiguration<String,String> configuration, @Symbol("tapestry.app-package") String appPackage)
-
provideBuiltinAssetDispatchers
@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)
Contributes an handler for each mapped classpath alias, as well handlers for context assets and stack assets (combinedJavaScriptStack
files).
-
addMappingsForLibraryVirtualFolders
@Contribute(ClasspathAssetAliasManager.class) public static void addMappingsForLibraryVirtualFolders(MappedConfiguration<String,String> configuration, ComponentClassResolver resolver)
-
setupGlobalMessageCatalog
@Contribute(ComponentMessagesSource.class) public static void setupGlobalMessageCatalog(AssetSource assetSource, @Symbol("tapestry.app-catalog") Resource applicationCatalog, OrderedConfiguration<Resource> configuration)
Contributes:- ClientLocalization
- A virtual resource of formatting symbols for decimal numbers
- Core
- Built in messages used by Tapestry's default validators and components
- AppCatalog
- The Resource defined by
SymbolConstants.APPLICATION_CATALOG
- Since:
- 5.2.0
-
setupAssetDispatch
@Contribute(Dispatcher.class) @Primary public static void setupAssetDispatch(OrderedConfiguration<Dispatcher> configuration, @AssetRequestDispatcher Dispatcher assetDispatcher)
-
buildClasspathAssetProtectionRule
@Primary public static ClasspathAssetProtectionRule buildClasspathAssetProtectionRule(List<ClasspathAssetProtectionRule> rules, ChainBuilder chainBuilder)
-
contributeClasspathAssetProtectionRule
public static void contributeClasspathAssetProtectionRule(OrderedConfiguration<ClasspathAssetProtectionRule> configuration)
-
-