Compress Plugin
Compresses output by having a servlet filter conditionally pipe whatever your web application produces to a GZIP-compressed file
This is the easiest way to compress your Grails app output with just a simple installation.
To install,
grails install-plugin compress
Usage
Once installed, this plugin will start gzip-compressing web textual output without any configuration. For configuration details please see "Configuration" section below.
To determine is the compression is working, use Firefox Addon's Web Developer Tool to view the document size. Right click, Web Developer -> Information -> View Documentation Size.
Configuration
Configuration are based on the api docs here:
http://pjl-comp-filter.sourceforge.net/com/planetj/servlet/filter/compression/CompressingFilter.html.
Please see below for the configuration options specifiable in Config.groovy.
compress {
// just in case for some reason you want to disable the filter
enabled = true debug = false
statsEnabled = true
compressionThreshold = 1024
// filter's url-patterns
urlPatterns = ["/*"]
// include and exclude are mutually exclusive
includePathPatterns = []
excludePathPatterns = [".*\\.gif", ".*\\.ico", ".*\\.jpg", ".*\\.swf"]
// include and exclude are mutually exclusive
includeContentTypes = []
excludeContentTypes = ["image/png"]
// include and exclude are mutually exclusive
includeUserAgentPatterns = []
excludeUserAgentPatterns = [".*MSIE 4.*"]
// probably don't want these, but their available if needed
javaUtilLogger = ""
jakartaCommonsLogger = "" development {
debug = true
compressionThreshold = 2048
}
production {
statsEnabled = false
}
}Statistic
There is tag library that will output the various statistics that are provided by the package found here:
http://pjl-comp-filter.sourceforge.net/com/planetj/servlet/filter/compression/CompressingFilterStats.html. Set statsEnabled to true to enable.
Changelog0.3 Updated to latest pjl-comp-filter 1.6.6 and added sensible defaults0.2 Configurable now -- big thanks to Kevin Burke0.1 First release
No Comments Yet
Post a Comment
Site Login