org.apache.tapestry5.modules

## Class AssetsModule

- java.lang.Object
- - org.apache.tapestry5.modules.AssetsModule

-     @Marker(value=Core.class)
      public class AssetsModule
      extends Object

  Since:
    5.3

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AssetsModule()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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-fontobject
    `StreamableResourceSource` | `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 (combined `JavaScriptStack` 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-fontobject
    `StreamableResourceSource` | `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 by `SymbolConstants.APPLICATION_CATALOG`
    `static void` | `setupSymbols(MappedConfiguration<String,Object> configuration)`
    `StreamableResourceSource` | `setupTextAssetsAsUTF8(StreamableResourceSource delegate)` Ensures that all "text/*" assets are given the UTF-8 charset.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AssetsModule

          public AssetsModule()

  - ### Method Detail

    - #### bind

          public static void bind(ServiceBinder binder)

    - #### configureStandardAssetFactories

          @Contribute(value=AssetSource.class)
          public void configureStandardAssetFactories(MappedConfiguration<String,AssetFactory> configuration,
                                                                                           @ContextProvider
                                                                                           AssetFactory contextAssetFactory,
                                                                                           @ClasspathProvider
                                                                                           AssetFactory classpathAssetFactory)

    - #### setupSymbols

          @Contribute(value=SymbolProvider.class)
           @FactoryDefaults
          public static void setupSymbols(MappedConfiguration<String,Object> configuration)

    - #### enableCompression

          @Decorate(id="GZipCompression",
                    serviceInterface=StreamableResourceSource.class)
          public StreamableResourceSource enableCompression(StreamableResourceSource delegate,
                                                                                                                                                       @Symbol(value="tapestry.gzip-compression-enabled")
                                                                                                                                                       boolean gzipEnabled,
                                                                                                                                                       @Symbol(value="tapestry.min-gzip-size")
                                                                                                                                                       int compressionCutoff,
                                                                                                                                                       AssetChecksumGenerator checksumGenerator)

    - #### enableCompressedCaching

          @Decorate(id="CacheCompressed",
                    serviceInterface=StreamableResourceSource.class)
           @Order(value="before:GZIpCompression")
          public StreamableResourceSource enableCompressedCaching(StreamableResourceSource delegate,
                                                                                                                                                                                                     @Symbol(value="tapestry.gzip-compression-enabled")
                                                                                                                                                                                                     boolean gzipEnabled,
                                                                                                                                                                                                     ResourceChangeTracker tracker)

    - #### enableUncompressedCaching

          @Decorate(id="Cache",
                    serviceInterface=StreamableResourceSource.class)
           @Order(value="after:GZipCompression")
          public StreamableResourceSource enableUncompressedCaching(StreamableResourceSource delegate,
                                                                                                                                                                                            ResourceChangeTracker tracker)

    - #### enableMinification

          @Decorate(id="Minification",
                    serviceInterface=StreamableResourceSource.class)
           @Order(value="after:Cache,TextUTF8")
          public StreamableResourceSource enableMinification(StreamableResourceSource delegate,
                                                                                                                                                                                           ResourceMinimizer minimizer,
                                                                                                                                                                                           @Symbol(value="tapestry.enable-minification")
                                                                                                                                                                                           boolean enabled)

    - #### enableCSSURLRewriting

          @Decorate(id="CSSURLRewrite",
                    serviceInterface=StreamableResourceSource.class)
           @Order(value="after:Minification")
          public StreamableResourceSource enableCSSURLRewriting(StreamableResourceSource delegate,
                                                                                                                                                                                             OperationTracker tracker,
                                                                                                                                                                                             AssetSource assetSource,
                                                                                                                                                                                             AssetChecksumGenerator checksumGenerator,
                                                                                                                                                                                             @Symbol(value="tapestry.strict-css-url-rewriting")
                                                                                                                                                                                             boolean strictCssUrlRewriting)

    - #### setupDisableMinificationByJavaScriptStack

          @Decorate(id="DisableMinificationForStacks",
                    serviceInterface=StreamableResourceSource.class)
           @Order(value="before:Minification")
          public StreamableResourceSource setupDisableMinificationByJavaScriptStack(StreamableResourceSource delegate,
                                                                                                                                                                                                                                 @Symbol(value="tapestry.enable-minification")
                                                                                                                                                                                                                                 boolean enabled,
                                                                                                                                                                                                                                 JavaScriptStackSource javaScriptStackSource,
                                                                                                                                                                                                                                 Request request)

    - #### setupTextAssetsAsUTF8

          @Decorate(id="TextUTF8",
                    serviceInterface=StreamableResourceSource.class)
           @Order(value="after:Cache")
          public StreamableResourceSource setupTextAssetsAsUTF8(StreamableResourceSource delegate)

      Ensures that all "text/*" assets are given the UTF-8 charset.
      Since:
        5.4

    - #### setupDefaultContentTypeMappings

          @Contribute(value=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(value=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(value=ContextProvider.class)
          public static AssetFactory buildContextAssetFactory(ApplicationGlobals globals,
                                                                                                   AssetPathConstructor assetPathConstructor,
                                                                                                   ResponseCompressionAnalyzer compressionAnalyzer,
                                                                                                   ResourceChangeTracker resourceChangeTracker,
                                                                                                   StreamableResourceSource streamableResourceSource)

    - #### addApplicationAndTapestryMappings

          @Contribute(value=ClasspathAssetAliasManager.class)
          public static void addApplicationAndTapestryMappings(MappedConfiguration<String,String> configuration,
                                                                                                                   @Symbol(value="tapestry.app-package")
                                                                                                                   String appPackage)

    - #### provideBuiltinAssetDispatchers

          @Contribute(value=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 (combined `JavaScriptStack` files).

    - #### addMappingsForLibraryVirtualFolders

          @Contribute(value=ClasspathAssetAliasManager.class)
          public static void addMappingsForLibraryVirtualFolders(MappedConfiguration<String,String> configuration,
                                                                                                                     ComponentClassResolver resolver)

    - #### setupGlobalMessageCatalog

          @Contribute(value=ComponentMessagesSource.class)
          public static void setupGlobalMessageCatalog(AssetSource assetSource,
                                                                                                        @Symbol(value="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(value=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)

5.6.0 - Copyright © 2003-2020 The Apache Software Foundation.