@ManagedObject(value="Push cache based on the HTTP \'Referer\' header") public class PushCacheFilter extends Object implements Filter
A filter that builds a cache of secondary resources associated to primary resources.
A typical request for a primary resource such as index.html
is immediately followed by a number of requests for secondary resources.
Secondary resource requests will have a Referer
HTTP header
that points to index.html
, which is used to associate the secondary
resource to the primary resource.
Only secondary resources that are requested within a (small) time period from the request of the primary resource are associated with the primary resource.
This allows to build a cache of secondary resources associated with
primary resources. When a request for a primary resource arrives, associated
secondary resources are pushed to the client, unless the request carries
If-xxx
header that hint that the client has the resources in its
cache.
Constructor and Description |
---|
PushCacheFilter() |
Modifier and Type | Method and Description |
---|---|
void |
clearPushCache() |
void |
destroy() |
void |
doFilter(ServletRequest req,
ServletResponse resp,
FilterChain chain) |
Map<String,String> |
getPushCache() |
void |
init(FilterConfig config) |
void |
renewPushCache() |
public void init(FilterConfig config) throws ServletException
init
in interface Filter
ServletException
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException
doFilter
in interface Filter
IOException
ServletException
@ManagedAttribute(value="The push cache contents") public Map<String,String> getPushCache()
@ManagedOperation(value="Renews the push cache contents", impact="ACTION") public void renewPushCache()
@ManagedOperation(value="Clears the push cache contents", impact="ACTION") public void clearPushCache()
Copyright © 1995-2016 Webtide. All Rights Reserved.