Class ConditionalRequestBuilder
- java.lang.Object
-
- org.apache.http.impl.client.cache.ConditionalRequestBuilder
-
@Contract(threading=IMMUTABLE) class ConditionalRequestBuilder extends java.lang.Object- Since:
- 4.1
-
-
Constructor Summary
Constructors Constructor Description ConditionalRequestBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpRequestWrapperbuildConditionalRequest(HttpRequestWrapper request, HttpCacheEntry cacheEntry)When aHttpCacheEntryis stale but 'might' be used as a response to anHttpRequestwe will attempt to revalidate the entry with the origin.HttpRequestWrapperbuildConditionalRequestFromVariants(HttpRequestWrapper request, java.util.Map<java.lang.String,Variant> variants)When aHttpCacheEntrydoes not exist for a specificHttpRequestwe attempt to see if an existingHttpCacheEntryis appropriate by building a conditionalHttpRequestusing the variants' ETag values.HttpRequestWrapperbuildUnconditionalRequest(HttpRequestWrapper request, HttpCacheEntry entry)Returns a request to unconditionally validate a cache entry with the origin.
-
-
-
Method Detail
-
buildConditionalRequest
public HttpRequestWrapper buildConditionalRequest(HttpRequestWrapper request, HttpCacheEntry cacheEntry) throws org.apache.http.ProtocolException
When aHttpCacheEntryis stale but 'might' be used as a response to anHttpRequestwe will attempt to revalidate the entry with the origin. Build the originHttpRequesthere and return it.- Parameters:
request- the original request from the callercacheEntry- the entry that needs to be re-validated- Returns:
- the wrapped request
- Throws:
org.apache.http.ProtocolException- when I am unable to build a new origin request.
-
buildConditionalRequestFromVariants
public HttpRequestWrapper buildConditionalRequestFromVariants(HttpRequestWrapper request, java.util.Map<java.lang.String,Variant> variants)
When aHttpCacheEntrydoes not exist for a specificHttpRequestwe attempt to see if an existingHttpCacheEntryis appropriate by building a conditionalHttpRequestusing 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
public HttpRequestWrapper buildUnconditionalRequest(HttpRequestWrapper request, HttpCacheEntry entry)
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 satisfyentry- existing cache entry we are trying to validate- Returns:
- an unconditional validation request
-
-