Resource Loading Strategies - reasonable defaults
lfryc Oct 13, 2011 5:07 AMHi guys,
I would like to open discussion for "reasonable defaults" of Resource-Mapping feature, which enables you to do Compression and Packaging of resources.
This feature contains several benefits for user, as he can:
- enable/disable mapping (which leads to using static resources),
- change the project stages where he prefers to use packaged/compressed resources,
- effectively enabling LOAD_ALL strategy from RF 3.x
- but still fine-grained to be able develop and debug without pain,
- effectively enabling LOAD_ALL strategy from RF 3.x
- serve resources from another location or even server (either all or selected ones - useful for CDNs),
The configurations options are as follows:
- org.richfaces.resourceMapping.enabled
- set if mapping is enabled (and enables serving of packed and compressed resources)
- org.richfaces.resourceMapping.location
- the top-level URL where the directory with resources is located
- default: bundled folder, may contain EL expressions or may point to another server
- org.richfaces.resourceMapping.mappingFile
- the top-level URL where the mapping configuration file is located
- default: mapping file is selected according to state of compression and packaging (see bellow)
- org.richfaces.resourceMapping.compressedStages
- to set if compression is enabled
- default: Production,System-Test
- org.richfaces.resourceMapping.packedStages
- to set if packaging is enabled
- default: (see the default discussion for enabled)
- to set if packaging is enabled
But there will need to be considered two configurations from 4.0
- resources were generated dynamically by default
- that means they weren't compressed nor packaged
- that means they weren't compressed nor packaged
- org.richfaces.staticResourceLocation option backward compatibility
- this option allowed to map resources in 4.0 (very similary to org.richfaces.resourceMapping.location
We have discussed three ways with Brian:
- be aggresive in performance optimizations
- enable mapping to static resources by default
- enable compression in Production and System-Test
- remove support for org.richfaces.staticResourceLocation
- keep backward compatibility
- no mapping by default, use dynamically generated resources (as in 4.0)
- enable compression in Production and System-Test (when mapping enabled)
- write compatibility layer for org.richfaces.staticResourceLocation context-param (see above)
- no mapping by default, use dynamically generated resources (as in 4.0)
- enable packaging by default
- either if mapping enabled/disabled by default, packaging has it's consequences
- client needs to load all resources for whole framework
- but he do so in one request to server per resource type (CSS/JS)
- thus highly depends on use case
- either if mapping enabled/disabled by default, packaging has it's consequences
Obviously, we can choose something between those options.