Class ConditionalRequestBuilder<T extends org.apache.hc.core5.http.HttpRequest>
java.lang.Object
org.apache.hc.client5.http.impl.cache.ConditionalRequestBuilder<T>
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionConditionalRequestBuilder
(org.apache.hc.core5.function.Factory<T, T> messageCopier) -
Method Summary
Modifier and TypeMethodDescriptionbuildConditionalRequest
(T request, HttpCacheEntry cacheEntry) When aHttpCacheEntry
is stale but 'might' be used as a response to anHttpRequest
we will attempt to revalidate the entry with the origin.buildConditionalRequestFromVariants
(T request, Map<String, Variant> variants) When aHttpCacheEntry
does not exist for a specificHttpRequest
we attempt to see if an existingHttpCacheEntry
is appropriate by building a conditionalHttpRequest
using the variants' ETag values.buildUnconditionalRequest
(T request) Returns a request to unconditionally validate a cache entry with the origin.
-
Field Details
-
messageCopier
-
-
Constructor Details
-
ConditionalRequestBuilder
-
-
Method Details
-
buildConditionalRequest
When aHttpCacheEntry
is stale but 'might' be used as a response to anHttpRequest
we will attempt to revalidate the entry with the origin. Build the originHttpRequest
here and return it.- Parameters:
request
- the original request from the callercacheEntry
- the entry that needs to be re-validated- Returns:
- the wrapped request
-
buildConditionalRequestFromVariants
When aHttpCacheEntry
does not exist for a specificHttpRequest
we attempt to see if an existingHttpCacheEntry
is appropriate by building a conditionalHttpRequest
using the variants' ETag values. If no such values exist, the request is unmodified- Parameters:
request
- the original request from the callervariants
-- Returns:
- the wrapped request
-
buildUnconditionalRequest
Returns a request to unconditionally validate a cache entry with the origin. In certain cases (due to multiple intervening caches) our cache may actually receive a response to a normal conditional validation where the Date header is actually older than that of our current cache entry. In this case, the protocol recommendation is to retry the validation and force syncup with the origin.- Parameters:
request
- client request we are trying to satisfy- Returns:
- an unconditional validation request
-