@Provider public class CacheControlFilter extends Object implements ContainerResponseFilter
ContainerResponseFilter
that adds Cache-Control headers to all
GET
responses.Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_HTTP_CACHE_MAX_AGE
The configuration key for setting a cache-control max-age header.
|
static String |
CONFIG_HTTP_CACHE_NOCACHE
The configuration key for setting a cache-control no-cache header.
|
static String |
CONFIG_HTTP_CACHE_REVALIDATE
The configuration key for setting a cache-control must-revalidate header.
|
Constructor and Description |
---|
CacheControlFilter()
Create a new CacheControl Decorator.
|
CacheControlFilter(int cacheAge,
boolean revalidate,
boolean noCache)
Create a new CacheControl Decorator.
|
Modifier and Type | Method and Description |
---|---|
void |
filter(ContainerRequestContext req,
ContainerResponseContext res) |
public static final String CONFIG_HTTP_CACHE_MAX_AGE
public static final String CONFIG_HTTP_CACHE_REVALIDATE
public static final String CONFIG_HTTP_CACHE_NOCACHE
@Inject public CacheControlFilter()
public CacheControlFilter(int cacheAge, boolean revalidate, boolean noCache)
cacheAge
- the length of time to cache resourcesrevalidate
- whether the cache must verify the status of stale resourcesnoCache
- whether to set the no-cache valuepublic void filter(ContainerRequestContext req, ContainerResponseContext res)
filter
in interface ContainerResponseFilter