Class HttpCacheEntryFactory
java.lang.Object
org.apache.hc.client5.http.cache.HttpCacheEntryFactory
HttpCacheEntry factory.- Since:
- 5.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpCacheEntryFactoryDefault instance ofHttpCacheEntryFactory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy(HttpCacheEntry entry) Creates a copy of the givenHttpCacheEntry.create(Instant requestInstant, Instant responseInstant, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, Resource resource) Create a newHttpCacheEntrywith the givenResource.createRoot(HttpCacheEntry latestVariant, Collection<String> variants) Creates a new rootHttpCacheEntry(parent of multiple variants).createUpdated(Instant requestInstant, Instant responseInstant, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, HttpCacheEntry entry) Creates updated entry with the new information from the response.(package private) static voidensureDate(org.apache.hc.core5.http.message.HeaderGroup headers, Instant instant) (package private) static org.apache.hc.core5.http.message.HeaderGroupfilterHopByHopHeaders(org.apache.hc.core5.http.HttpMessage message) This method should be provided by the coreprivate static org.apache.hc.core5.http.message.HeaderGroup(package private) org.apache.hc.core5.http.message.HeaderGroupmergeHeaders(HttpCacheEntry entry, org.apache.hc.core5.http.HttpResponse response)
-
Field Details
-
INSTANCE
Default instance ofHttpCacheEntryFactory.
-
-
Constructor Details
-
HttpCacheEntryFactory
public HttpCacheEntryFactory()
-
-
Method Details
-
headers
private static org.apache.hc.core5.http.message.HeaderGroup headers(Iterator<org.apache.hc.core5.http.Header> it) -
mergeHeaders
org.apache.hc.core5.http.message.HeaderGroup mergeHeaders(HttpCacheEntry entry, org.apache.hc.core5.http.HttpResponse response) -
filterHopByHopHeaders
static org.apache.hc.core5.http.message.HeaderGroup filterHopByHopHeaders(org.apache.hc.core5.http.HttpMessage message) This method should be provided by the core -
ensureDate
-
createRoot
Creates a new rootHttpCacheEntry(parent of multiple variants).- Parameters:
latestVariant- The most recently created variant entryvariants- describing cache entries that are variants of this parent entry; this maps a "variant key" (derived from the varying request headers) to a "cache key" (where in the cache storage the particular variant is located)
-
create
public HttpCacheEntry create(Instant requestInstant, Instant responseInstant, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, Resource resource) Create a newHttpCacheEntrywith the givenResource.- Parameters:
requestInstant- Date/time when the request was made (Used for age calculations)responseInstant- Date/time that the response came back (Used for age calculations)host- Target hostrequest- Original client request (a deep copy of this object is made)response- Origin response (a deep copy of this object is made)resource- Resource representing origin response body
-
createUpdated
public HttpCacheEntry createUpdated(Instant requestInstant, Instant responseInstant, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, HttpCacheEntry entry) Creates updated entry with the new information from the response. Should only be used for 304 responses.- Parameters:
requestInstant- Date/time when the request was made (Used for age calculations)responseInstant- Date/time that the response came back (Used for age calculations)host- Target hostrequest- Original client request (a deep copy of this object is made)response- Origin response (a deep copy of this object is made)entry- Existing cache entry.
-
copy
Creates a copy of the givenHttpCacheEntry. Please note the underlyingResourceis copied by reference.
-