@Contract(threading=IMMUTABLE_CONDITIONAL)
class CacheEntryUpdater
extends java.lang.Object
HttpCacheEntry
with new or updated information based on the latest
304 status response from the Server. Use the HttpResponse
to perform
the update.Modifier and Type | Field and Description |
---|---|
private ResourceFactory |
resourceFactory |
Constructor and Description |
---|
CacheEntryUpdater() |
CacheEntryUpdater(ResourceFactory resourceFactory) |
Modifier and Type | Method and Description |
---|---|
private boolean |
entryAndResponseHaveDateHeader(HttpCacheEntry entry,
org.apache.http.HttpResponse response) |
private boolean |
entryDateHeaderNewerThenResponse(HttpCacheEntry entry,
org.apache.http.HttpResponse response) |
protected org.apache.http.Header[] |
mergeHeaders(HttpCacheEntry entry,
org.apache.http.HttpResponse response) |
private void |
removeCacheEntry1xxWarnings(java.util.List<org.apache.http.Header> cacheEntryHeaderList,
HttpCacheEntry entry) |
private void |
removeCacheHeadersThatMatchResponse(java.util.List<org.apache.http.Header> cacheEntryHeaderList,
org.apache.http.HttpResponse response) |
HttpCacheEntry |
updateCacheEntry(java.lang.String requestId,
HttpCacheEntry entry,
java.util.Date requestDate,
java.util.Date responseDate,
org.apache.http.HttpResponse response)
Update the entry with the new information from the response.
|
private final ResourceFactory resourceFactory
CacheEntryUpdater()
CacheEntryUpdater(ResourceFactory resourceFactory)
public HttpCacheEntry updateCacheEntry(java.lang.String requestId, HttpCacheEntry entry, java.util.Date requestDate, java.util.Date responseDate, org.apache.http.HttpResponse response) throws java.io.IOException
requestId
- entry
- The cache Entry to be updatedrequestDate
- When the request was performedresponseDate
- When the response was gottenresponse
- The HttpResponse from the backend server calljava.io.IOException
- if something bad happens while trying to read the body from the original entryprotected org.apache.http.Header[] mergeHeaders(HttpCacheEntry entry, org.apache.http.HttpResponse response)
private void removeCacheHeadersThatMatchResponse(java.util.List<org.apache.http.Header> cacheEntryHeaderList, org.apache.http.HttpResponse response)
private void removeCacheEntry1xxWarnings(java.util.List<org.apache.http.Header> cacheEntryHeaderList, HttpCacheEntry entry)
private boolean entryDateHeaderNewerThenResponse(HttpCacheEntry entry, org.apache.http.HttpResponse response)
private boolean entryAndResponseHaveDateHeader(HttpCacheEntry entry, org.apache.http.HttpResponse response)