@Contract(threading=IMMUTABLE_CONDITIONAL)
class CachedHttpResponseGenerator
extends java.lang.Object
HttpResponse
from a net.sf.ehcache.CacheEntry
Modifier and Type | Field and Description |
---|---|
private CacheValidityPolicy |
validityStrategy |
Constructor and Description |
---|
CachedHttpResponseGenerator() |
CachedHttpResponseGenerator(CacheValidityPolicy validityStrategy) |
Modifier and Type | Method and Description |
---|---|
private void |
addMissingContentLengthHeader(org.apache.http.HttpResponse response,
org.apache.http.HttpEntity entity) |
(package private) CloseableHttpResponse |
generateNotModifiedResponse(HttpCacheEntry entry)
Generate a 304 - Not Modified response from a
CacheEntity . |
(package private) CloseableHttpResponse |
generateResponse(HttpRequestWrapper request,
HttpCacheEntry entry)
If I was able to use a
CacheEntity to response to the HttpRequest then
generate an HttpResponse based on the cache entry. |
private boolean |
responseShouldContainEntity(HttpRequestWrapper request,
HttpCacheEntry cacheEntry) |
private boolean |
transferEncodingIsPresent(org.apache.http.HttpResponse response) |
private final CacheValidityPolicy validityStrategy
CachedHttpResponseGenerator(CacheValidityPolicy validityStrategy)
CachedHttpResponseGenerator()
CloseableHttpResponse generateResponse(HttpRequestWrapper request, HttpCacheEntry entry)
CacheEntity
to response to the HttpRequest
then
generate an HttpResponse
based on the cache entry.request
- HttpRequestWrapper
to generate the response forentry
- CacheEntity
to transform into an HttpResponse
HttpResponse
that was constructedCloseableHttpResponse generateNotModifiedResponse(HttpCacheEntry entry)
CacheEntity
. This should be
used to respond to conditional requests, when the entry exists or has been re-validated.private void addMissingContentLengthHeader(org.apache.http.HttpResponse response, org.apache.http.HttpEntity entity)
private boolean transferEncodingIsPresent(org.apache.http.HttpResponse response)
private boolean responseShouldContainEntity(HttpRequestWrapper request, HttpCacheEntry cacheEntry)