Class CacheEntryUpdater
- java.lang.Object
-
- org.apache.http.impl.client.cache.CacheEntryUpdater
-
@Contract(threading=IMMUTABLE_CONDITIONAL) class CacheEntryUpdater extends java.lang.ObjectUpdate aHttpCacheEntrywith new or updated information based on the latest 304 status response from the Server. Use theHttpResponseto perform the update.- Since:
- 4.1
-
-
Field Summary
Fields Modifier and Type Field Description private ResourceFactoryresourceFactory
-
Constructor Summary
Constructors Constructor Description CacheEntryUpdater()CacheEntryUpdater(ResourceFactory resourceFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanentryAndResponseHaveDateHeader(HttpCacheEntry entry, org.apache.http.HttpResponse response)private booleanentryDateHeaderNewerThenResponse(HttpCacheEntry entry, org.apache.http.HttpResponse response)protected org.apache.http.Header[]mergeHeaders(HttpCacheEntry entry, org.apache.http.HttpResponse response)HttpCacheEntryupdateCacheEntry(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.
-
-
-
Field Detail
-
resourceFactory
private final ResourceFactory resourceFactory
-
-
Constructor Detail
-
CacheEntryUpdater
CacheEntryUpdater()
-
CacheEntryUpdater
CacheEntryUpdater(ResourceFactory resourceFactory)
-
-
Method Detail
-
updateCacheEntry
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
Update the entry with the new information from the response. Should only be used for 304 responses.- Parameters:
requestId-entry- The cache Entry to be updatedrequestDate- When the request was performedresponseDate- When the response was gottenresponse- The HttpResponse from the backend server call- Returns:
- HttpCacheEntry an updated version of the cache entry
- Throws:
java.io.IOException- if something bad happens while trying to read the body from the original entry
-
mergeHeaders
protected org.apache.http.Header[] mergeHeaders(HttpCacheEntry entry, org.apache.http.HttpResponse response)
-
entryDateHeaderNewerThenResponse
private boolean entryDateHeaderNewerThenResponse(HttpCacheEntry entry, org.apache.http.HttpResponse response)
-
entryAndResponseHaveDateHeader
private boolean entryAndResponseHaveDateHeader(HttpCacheEntry entry, org.apache.http.HttpResponse response)
-
-