SetExpirationHeaders
instead.public class CacheHeadersFilter
extends info.magnolia.cms.filters.AbstractMgnlFilter
Filter that sets cache headers, allowing or dening cache at client-side. By default the filter adds the "Cache-Control: public" and expire directives to resources so that everything can be cached by the browser. Setting the nocache
property to true
has the opposite effect, forcing browsers to avoid caching.
The following example shows how to configure the filter so that static resources (images, css, js) gets cached by the browser, and deny cache for html pages.
+ server + filters + ... + headers-cache - class info.magnolia.module.cache.filter.CacheHeadersFilter - expirationMinutes 1440 (default) + bypasses + extensions - class info.magnolia.voting.voters.ExtensionVoter - allow gif,jpg,png,swf,css,js - not true + headers-nocache - class info.magnolia.module.cache.filter.CacheHeadersFilter - nocache true + bypasses + extensions - class info.magnolia.voting.voters.ExtensionVoter - allow html - not true
Constructor and Description |
---|
CacheHeadersFilter()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
doFilter(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain)
Deprecated.
|
void |
setExpirationMinutes(long expirationMinutes)
Deprecated.
Sets the expirationMinutes.
|
void |
setNocache(boolean nocache)
Deprecated.
Sets the nocache.
|
acceptsEncoding, acceptsGzipEncoding, addAndVerifyHeader, addBypass, addMapping, bypasses, destroy, doFilter, getBypasses, getDispatching, getMapping, getMappings, getName, headerContains, init, isEnabled, mapsTo, matches, matchesDispatching, setBypasses, setDispatching, setEnabled, setMappings, setName
public void setExpirationMinutes(long expirationMinutes)
expirationMinutes
- the expirationMinutes to setpublic void setNocache(boolean nocache)
nocache
- the nocache to setpublic void doFilter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in class info.magnolia.cms.filters.AbstractMgnlFilter
IOException
javax.servlet.ServletException
Copyright © 2019 Magnolia International Ltd.. All rights reserved.