public final class HttpCacheHeaderUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
HttpCacheHeaderUtil.EtagCacheVal |
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<SolrCore,HttpCacheHeaderUtil.EtagCacheVal> |
etagCoreCache
Weak Ref based cache for keeping track of core specific etagSeed
and the last computed etag.
|
Constructor and Description |
---|
HttpCacheHeaderUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
calcEtag(SolrQueryRequest solrReq)
Calculates a tag for the ETag header.
|
static long |
calcLastModified(SolrQueryRequest solrReq)
Calculate the appropriate last-modified time for Solr relative the current request.
|
static boolean |
checkETagValidators(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
Method reqMethod,
java.lang.String etag)
Check for etag related conditional headers and set status
|
static void |
checkHttpCachingVeto(SolrQueryResponse solrRsp,
javax.servlet.http.HttpServletResponse resp,
Method reqMethod)
Checks if the downstream request handler wants to avoid HTTP caching of
the response.
|
static boolean |
checkLastModValidators(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
long lastMod)
Check for modify time related conditional headers and set status
|
static boolean |
doCacheHeaderValidation(SolrQueryRequest solrReq,
javax.servlet.http.HttpServletRequest req,
Method reqMethod,
javax.servlet.http.HttpServletResponse resp)
Sets HTTP Response cache validator headers appropriately and
validates the HTTP Request against these using any conditional
request headers.
|
static boolean |
isMatchingEtag(java.util.List<java.lang.String> headerList,
java.lang.String etag)
Checks if one of the tags in the list equals the given etag.
|
static void |
sendNotModified(javax.servlet.http.HttpServletResponse res) |
static void |
sendPreconditionFailed(javax.servlet.http.HttpServletResponse res) |
static void |
setCacheControlHeader(SolrConfig conf,
javax.servlet.http.HttpServletResponse resp,
Method method)
Set the Cache-Control HTTP header (and Expires if needed)
based on the SolrConfig.
|
private static java.util.Map<SolrCore,HttpCacheHeaderUtil.EtagCacheVal> etagCoreCache
public static void sendNotModified(javax.servlet.http.HttpServletResponse res) throws java.io.IOException
java.io.IOException
public static void sendPreconditionFailed(javax.servlet.http.HttpServletResponse res) throws java.io.IOException
java.io.IOException
public static java.lang.String calcEtag(SolrQueryRequest solrReq)
solrReq
- public static boolean isMatchingEtag(java.util.List<java.lang.String> headerList, java.lang.String etag)
headerList
- the ETag header related header elementsetag
- the ETag to compare withpublic static long calcLastModified(SolrQueryRequest solrReq)
solrReq
- public static void setCacheControlHeader(SolrConfig conf, javax.servlet.http.HttpServletResponse resp, Method method)
conf
- The config of the SolrCore handling this requestresp
- The servlet response object to modifymethod
- The request method (GET, POST, ...) used by this requestpublic static boolean doCacheHeaderValidation(SolrQueryRequest solrReq, javax.servlet.http.HttpServletRequest req, Method reqMethod, javax.servlet.http.HttpServletResponse resp) throws java.io.IOException
java.io.IOException
public static boolean checkETagValidators(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, Method reqMethod, java.lang.String etag) throws java.io.IOException
java.io.IOException
public static boolean checkLastModValidators(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, long lastMod) throws java.io.IOException
java.io.IOException
public static void checkHttpCachingVeto(SolrQueryResponse solrRsp, javax.servlet.http.HttpServletResponse resp, Method reqMethod)
solrRsp
- The Solr response objectresp
- The HTTP servlet response objectreqMethod
- The HTTP request type