- All Implemented Interfaces:
- javax.servlet.Filter, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.EnvironmentAware, org.springframework.core.env.EnvironmentCapable, org.springframework.core.Ordered, org.springframework.web.context.ServletContextAware
@Component(value="blHtmlMinifyFilter")
@ConditionalOnProperty(value="filter.html.minification.enabled")
public class HtmlMinifyFilter
extends org.springframework.web.filter.OncePerRequestFilter
implements org.springframework.core.Ordered
Enable html minification. All unnecessary white space will be removed from html, inline CSS and inline JS. This should
serve to provide some reduction in byte size of the response. This is a suggested pagespeed optimization from Google.
The drawbacks of this filter include: a slight expense in processing the response payload, and the page response is
kept entirely in memory to facilitate processing before responding to the caller (usually the http response can be (is) pushed
back incrementally to avoid keeping the entire page contents in memory).
The filter is disabled by default. Activate by including this property declaration in your Spring environment property
file(s): filter.html.minification.enabled=true.
- Author:
- Jeff Fischer