public class HttpCacheUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
IFMATCH |
static String |
IFNONEMATCH |
| Constructor and Description |
|---|
HttpCacheUtils() |
| Modifier and Type | Method and Description |
|---|---|
javax.servlet.http.HttpServletResponse |
addDefaultHeaders(javax.servlet.http.HttpServletResponse response,
String eTag,
String tsUpdated)
Generate the default headers for sending a response with caching
The 'Cache-Control' and 'Allow' headers are always set to the same value
|
String |
dateToRFC1123String(Date date)
Formats the given java.util.Date according to the RFC 1123 pattern (e.g.
|
boolean |
doesAnyIfNoneMatch(javax.servlet.http.HttpServletRequest request,
String eTag)
Supports multiple values in the "If-None-Match" header
|
boolean |
doesPreconditionFail(javax.servlet.http.HttpServletRequest request,
String eTag)
Supports multiple values in the "If-Match" header
|
String |
generateETag(String data,
boolean weakETag,
boolean includeApiVersion)
Generates an eTag surrounded with double quotes
|
boolean |
isModifiedSince(javax.servlet.http.HttpServletRequest request,
Date tsUpdated)
Deprecated.
|
boolean |
isNotModifiedSince(javax.servlet.http.HttpServletRequest request,
Date tsUpdated) |
public static final String IFNONEMATCH
public static final String IFMATCH
public String generateETag(String data, boolean weakETag, boolean includeApiVersion)
data - weakETag - if true then the eTag will start with W/includeApiVersion - if true then the API_version will be included in the ETag calculation (this is
recommended when calculating weak ETags) *public String dateToRFC1123String(Date date)
date - Date object to be formattedpublic javax.servlet.http.HttpServletResponse addDefaultHeaders(javax.servlet.http.HttpServletResponse response,
String eTag,
String tsUpdated)
response - required, HttpServletResponse to add the headers toeTag - optional, if not null then an ETag header is addedtsUpdated - optional, if not null then a Last-Modified header is addedpublic boolean doesAnyIfNoneMatch(javax.servlet.http.HttpServletRequest request,
String eTag)
request - incoming HttpServletRequesteTag - String with the calculated eTag of the requested datapublic boolean isNotModifiedSince(javax.servlet.http.HttpServletRequest request,
Date tsUpdated)
request - incoming HttpServletRequesttsUpdated - Date representing the FullBean's timestamp_updated@Deprecated public boolean isModifiedSince(javax.servlet.http.HttpServletRequest request, Date tsUpdated)
request - incoming HttpServletRequesttsUpdated - Date representing the FullBean's timestamp_updatedpublic boolean doesPreconditionFail(javax.servlet.http.HttpServletRequest request,
String eTag)
request - incoming HttpServletRequesteTag - String with the calculated eTag of the requested dataCopyright © 2019 Europeana Foundation. All rights reserved.