Class CachingHttpAsyncClient

java.lang.Object
org.apache.http.impl.client.cache.CachingHttpAsyncClient
All Implemented Interfaces:
HttpAsyncClient

@Contract(threading=SAFE) public class CachingHttpAsyncClient extends Object implements HttpAsyncClient
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private final HttpAsyncClient
     
    private final org.apache.http.impl.client.cache.CacheableRequestPolicy
     
    private final AtomicLong
     
    private final AtomicLong
     
    private final AtomicLong
     
    private final org.apache.http.impl.client.cache.ConditionalRequestBuilder
     
    private final org.apache.commons.logging.Log
     
    private final long
     
    private final org.apache.http.impl.client.cache.RequestProtocolCompliance
     
    private final org.apache.http.impl.client.cache.HttpCache
     
    private final org.apache.http.impl.client.cache.ResponseCachingPolicy
     
    private final org.apache.http.impl.client.cache.ResponseProtocolCompliance
     
    private final org.apache.http.impl.client.cache.CachedHttpResponseGenerator
     
    private final boolean
     
    private final org.apache.http.impl.client.cache.CachedResponseSuitabilityChecker
     
    private static final boolean
     
    private final org.apache.http.impl.client.cache.CacheValidityPolicy
     
    private final Map<org.apache.http.ProtocolVersion,String>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    CachingHttpAsyncClient(org.apache.http.impl.client.cache.CacheConfig config)
     
     
    CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.client.cache.HttpCacheStorage storage, org.apache.http.impl.client.cache.CacheConfig config)
     
    CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.client.cache.ResourceFactory resourceFactory, org.apache.http.client.cache.HttpCacheStorage storage, org.apache.http.impl.client.cache.CacheConfig config)
     
    CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.impl.client.cache.CacheConfig config)
     
    CachingHttpAsyncClient(HttpAsyncClient backend, org.apache.http.impl.client.cache.CacheValidityPolicy validityPolicy, org.apache.http.impl.client.cache.ResponseCachingPolicy responseCachingPolicy, org.apache.http.impl.client.cache.HttpCache responseCache, org.apache.http.impl.client.cache.CachedHttpResponseGenerator responseGenerator, org.apache.http.impl.client.cache.CacheableRequestPolicy cacheableRequestPolicy, org.apache.http.impl.client.cache.CachedResponseSuitabilityChecker suitabilityChecker, org.apache.http.impl.client.cache.ConditionalRequestBuilder conditionalRequestBuilder, org.apache.http.impl.client.cache.ResponseProtocolCompliance responseCompliance, org.apache.http.impl.client.cache.RequestProtocolCompliance requestCompliance)
     
    CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.impl.client.cache.HttpCache cache, org.apache.http.impl.client.cache.CacheConfig config)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private boolean
    alreadyHaveNewerCacheEntry(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.HttpResponse backendResponse)
     
    (package private) void
    callBackend(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext)
     
    (package private) boolean
    clientRequestsOurOptions(org.apache.http.HttpRequest request)
     
    Future<org.apache.http.HttpResponse>
    execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
    Initiates asynchronous HTTP request execution.
    Future<org.apache.http.HttpResponse>
    execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
    Initiates asynchronous HTTP request execution using the given context.
    Future<org.apache.http.HttpResponse>
    execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
    Initiates asynchronous HTTP request execution against the given target.
    Future<org.apache.http.HttpResponse>
    execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest originalRequest, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> futureCallback)
    Initiates asynchronous HTTP request execution against the given target using the given context.
    <T> Future<T>
    execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.concurrent.FutureCallback<T> callback)
    Initiates asynchronous HTTP request execution using the default context.
    <T> Future<T>
    execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<T> callback)
    Initiates asynchronous HTTP request execution using the given context.
    private boolean
    explicitFreshnessRequest(org.apache.http.HttpRequest request, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
     
    private void
    flushEntriesInvalidatedByRequest(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
     
    private org.apache.http.HttpResponse
    generateCachedResponse(org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
     
    private org.apache.http.HttpResponse
    generateGatewayTimeout(org.apache.http.client.cache.HttpCacheContext clientContext)
     
    private String
    generateViaHeader(org.apache.http.HttpMessage msg)
     
    long
    Reports the number of times that the cache successfully responded to an HttpRequest without contacting the origin server.
    long
    Reports the number of times that the cache contacted the origin server because it had no appropriate response cached.
    long
    Reports the number of times that the cache was able to satisfy a response by revalidating an existing but stale cache entry.
    (package private) Date
     
    private Map<String,org.apache.http.impl.client.cache.Variant>
    getExistingCacheVariants(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
     
    private org.apache.http.HttpResponse
    getFatallyNoncompliantResponse(org.apache.http.HttpRequest request, org.apache.http.client.cache.HttpCacheContext clientContext)
     
    private org.apache.http.client.cache.HttpCacheEntry
    getUpdatedVariantEntry(org.apache.http.HttpHost target, org.apache.http.HttpRequest conditionalRequest, Date requestDate, Date responseDate, org.apache.http.HttpResponse backendResponse, org.apache.http.impl.client.cache.Variant matchingVariant, org.apache.http.client.cache.HttpCacheEntry matchedEntry)
     
    (package private) org.apache.http.client.methods.CloseableHttpResponse
    handleBackendResponse(org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, Date requestDate, Date responseDate, org.apache.http.client.methods.CloseableHttpResponse backendResponse)
     
    private void
    handleCacheHit(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry)
     
    private void
    handleCacheMiss(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext)
     
    private org.apache.http.HttpResponse
    handleRevalidationFailure(org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
     
    boolean
    Reports whether this CachingHttpClient is configured as a shared (public) or non-shared (private) cache.
    makeAsynchronousValidator(org.apache.http.impl.client.cache.CacheConfig config)
     
    private boolean
    mayCallBackend(org.apache.http.HttpRequest request)
     
    (package private) void
    negotiateResponseFromVariants(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, Map<String,org.apache.http.impl.client.cache.Variant> variants)
     
    private void
    recordCacheHit(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
     
    private void
    recordCacheMiss(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
     
    private void
    recordCacheUpdate(org.apache.http.client.cache.HttpCacheContext clientContext)
     
    private void
    retryRequestUnconditionally(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry matchedEntry)
     
    (package private) void
    revalidateCacheEntry(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry cacheEntry)
     
    private void
    revalidateCacheEntry(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
     
    private void
    revalidateCacheEntryCompleted(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry cacheEntry, org.apache.http.client.methods.HttpRequestWrapper conditionalRequest, Date requestDate, org.apache.http.HttpResponse httpResponse, Date responseDate)
     
    private boolean
    revalidationResponseIsTooOld(org.apache.http.HttpResponse backendResponse, org.apache.http.client.cache.HttpCacheEntry cacheEntry)
     
    private org.apache.http.client.cache.HttpCacheEntry
    satisfyFromCache(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
     
    private void
    setResponseStatus(org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.CacheResponseStatus value)
     
    private boolean
    shouldSendNotModifiedResponse(org.apache.http.HttpRequest request, org.apache.http.client.cache.HttpCacheEntry responseEntry)
     
    private boolean
    staleIfErrorAppliesTo(int statusCode)
     
    private boolean
    staleResponseNotAllowed(org.apache.http.HttpRequest request, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
     
    private void
    storeRequestIfModifiedSinceFor304Response(org.apache.http.HttpRequest request, org.apache.http.HttpResponse backendResponse)
    For 304 Not modified responses, adds a "Last-Modified" header with the value of the "If-Modified-Since" header passed in the request.
    boolean
    Reports whether this CachingHttpClient implementation supports byte-range requests as specified by the Range and Content-Range headers.
    private void
    tryToUpdateVariantMap(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.impl.client.cache.Variant matchingVariant)
     
    private org.apache.http.HttpResponse
    unvalidatedCacheHit(org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheEntry entry)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SUPPORTS_RANGE_AND_CONTENT_RANGE_HEADERS

      private static final boolean SUPPORTS_RANGE_AND_CONTENT_RANGE_HEADERS
      See Also:
    • cacheHits

      private final AtomicLong cacheHits
    • cacheMisses

      private final AtomicLong cacheMisses
    • cacheUpdates

      private final AtomicLong cacheUpdates
    • viaHeaders

      private final Map<org.apache.http.ProtocolVersion,String> viaHeaders
    • backend

      private final HttpAsyncClient backend
    • responseCache

      private final org.apache.http.impl.client.cache.HttpCache responseCache
    • validityPolicy

      private final org.apache.http.impl.client.cache.CacheValidityPolicy validityPolicy
    • responseCachingPolicy

      private final org.apache.http.impl.client.cache.ResponseCachingPolicy responseCachingPolicy
    • responseGenerator

      private final org.apache.http.impl.client.cache.CachedHttpResponseGenerator responseGenerator
    • cacheableRequestPolicy

      private final org.apache.http.impl.client.cache.CacheableRequestPolicy cacheableRequestPolicy
    • suitabilityChecker

      private final org.apache.http.impl.client.cache.CachedResponseSuitabilityChecker suitabilityChecker
    • conditionalRequestBuilder

      private final org.apache.http.impl.client.cache.ConditionalRequestBuilder conditionalRequestBuilder
    • maxObjectSizeBytes

      private final long maxObjectSizeBytes
    • sharedCache

      private final boolean sharedCache
    • responseCompliance

      private final org.apache.http.impl.client.cache.ResponseProtocolCompliance responseCompliance
    • requestCompliance

      private final org.apache.http.impl.client.cache.RequestProtocolCompliance requestCompliance
    • asynchAsyncRevalidator

      private final AsynchronousAsyncValidator asynchAsyncRevalidator
    • log

      private final org.apache.commons.logging.Log log
  • Constructor Details

    • CachingHttpAsyncClient

      CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.impl.client.cache.HttpCache cache, org.apache.http.impl.client.cache.CacheConfig config)
    • CachingHttpAsyncClient

      public CachingHttpAsyncClient() throws org.apache.http.nio.reactor.IOReactorException
      Throws:
      org.apache.http.nio.reactor.IOReactorException
    • CachingHttpAsyncClient

      public CachingHttpAsyncClient(org.apache.http.impl.client.cache.CacheConfig config) throws org.apache.http.nio.reactor.IOReactorException
      Throws:
      org.apache.http.nio.reactor.IOReactorException
    • CachingHttpAsyncClient

      public CachingHttpAsyncClient(HttpAsyncClient client)
    • CachingHttpAsyncClient

      public CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.impl.client.cache.CacheConfig config)
    • CachingHttpAsyncClient

      public CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.client.cache.ResourceFactory resourceFactory, org.apache.http.client.cache.HttpCacheStorage storage, org.apache.http.impl.client.cache.CacheConfig config)
    • CachingHttpAsyncClient

      public CachingHttpAsyncClient(HttpAsyncClient client, org.apache.http.client.cache.HttpCacheStorage storage, org.apache.http.impl.client.cache.CacheConfig config)
    • CachingHttpAsyncClient

      CachingHttpAsyncClient(HttpAsyncClient backend, org.apache.http.impl.client.cache.CacheValidityPolicy validityPolicy, org.apache.http.impl.client.cache.ResponseCachingPolicy responseCachingPolicy, org.apache.http.impl.client.cache.HttpCache responseCache, org.apache.http.impl.client.cache.CachedHttpResponseGenerator responseGenerator, org.apache.http.impl.client.cache.CacheableRequestPolicy cacheableRequestPolicy, org.apache.http.impl.client.cache.CachedResponseSuitabilityChecker suitabilityChecker, org.apache.http.impl.client.cache.ConditionalRequestBuilder conditionalRequestBuilder, org.apache.http.impl.client.cache.ResponseProtocolCompliance responseCompliance, org.apache.http.impl.client.cache.RequestProtocolCompliance requestCompliance)
  • Method Details

    • makeAsynchronousValidator

      private AsynchronousAsyncValidator makeAsynchronousValidator(org.apache.http.impl.client.cache.CacheConfig config)
    • getCacheHits

      public long getCacheHits()
      Reports the number of times that the cache successfully responded to an HttpRequest without contacting the origin server.
      Returns:
      the number of cache hits
    • getCacheMisses

      public long getCacheMisses()
      Reports the number of times that the cache contacted the origin server because it had no appropriate response cached.
      Returns:
      the number of cache misses
    • getCacheUpdates

      public long getCacheUpdates()
      Reports the number of times that the cache was able to satisfy a response by revalidating an existing but stale cache entry.
      Returns:
      the number of cache revalidations
    • execute

      public Future<org.apache.http.HttpResponse> execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
      Description copied from interface: HttpAsyncClient
      Initiates asynchronous HTTP request execution against the given target.
      Specified by:
      execute in interface HttpAsyncClient
      Parameters:
      target - the target host for the request. Implementations may accept null if they can still determine a route, for example to a default target or by inspecting the request.
      request - the request to execute
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      public <T> Future<T> execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.concurrent.FutureCallback<T> callback)
      Description copied from interface: HttpAsyncClient
      Initiates asynchronous HTTP request execution using the default context.

      The request producer passed to this method will be used to generate a request message and stream out its content without buffering it in memory. The response consumer passed to this method will be used to process a response message without buffering its content in memory.

      Specified by:
      execute in interface HttpAsyncClient
      Type Parameters:
      T - the result type of request execution.
      Parameters:
      requestProducer - request producer callback.
      responseConsumer - response consumer callaback.
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      public <T> Future<T> execute(org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<T> callback)
      Description copied from interface: HttpAsyncClient
      Initiates asynchronous HTTP request execution using the given context.

      The request producer passed to this method will be used to generate a request message and stream out its content without buffering it in memory. The response consumer passed to this method will be used to process a response message without buffering its content in memory.

      Please note it may be unsafe to interact with the context instance while the request is still being executed.

      Specified by:
      execute in interface HttpAsyncClient
      Type Parameters:
      T - the result type of request execution.
      Parameters:
      requestProducer - request producer callback.
      responseConsumer - response consumer callaback.
      context - HTTP context
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      public Future<org.apache.http.HttpResponse> execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
      Description copied from interface: HttpAsyncClient
      Initiates asynchronous HTTP request execution.
      Specified by:
      execute in interface HttpAsyncClient
      Parameters:
      request - the request to execute
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      public Future<org.apache.http.HttpResponse> execute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> callback)
      Description copied from interface: HttpAsyncClient
      Initiates asynchronous HTTP request execution using the given context.

      Please note it may be unsafe to interact with the context instance while the request is still being executed.

      Specified by:
      execute in interface HttpAsyncClient
      Parameters:
      request - the request to execute
      context - HTTP context
      callback - future callback.
      Returns:
      future representing pending completion of the operation.
    • execute

      public Future<org.apache.http.HttpResponse> execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest originalRequest, org.apache.http.protocol.HttpContext context, org.apache.http.concurrent.FutureCallback<org.apache.http.HttpResponse> futureCallback)
      Description copied from interface: HttpAsyncClient
      Initiates asynchronous HTTP request execution against the given target using the given context.

      Please note it may be unsafe to interact with the context instance while the request is still being executed.

      Specified by:
      execute in interface HttpAsyncClient
      Parameters:
      target - the target host for the request. Implementations may accept null if they can still determine a route, for example to a default target or by inspecting the request.
      originalRequest - the request to execute
      context - the context to use for the execution, or null to use the default context
      futureCallback - future callback.
      Returns:
      future representing pending completion of the operation.
    • handleCacheHit

      private void handleCacheHit(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry) throws IOException
      Throws:
      IOException
    • revalidateCacheEntry

      private void revalidateCacheEntry(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry, Date now) throws org.apache.http.client.ClientProtocolException
      Throws:
      org.apache.http.client.ClientProtocolException
    • handleCacheMiss

      private void handleCacheMiss(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext)
    • satisfyFromCache

      private org.apache.http.client.cache.HttpCacheEntry satisfyFromCache(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
    • getFatallyNoncompliantResponse

      private org.apache.http.HttpResponse getFatallyNoncompliantResponse(org.apache.http.HttpRequest request, org.apache.http.client.cache.HttpCacheContext clientContext)
    • getExistingCacheVariants

      private Map<String,org.apache.http.impl.client.cache.Variant> getExistingCacheVariants(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
    • recordCacheMiss

      private void recordCacheMiss(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
    • recordCacheHit

      private void recordCacheHit(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
    • recordCacheUpdate

      private void recordCacheUpdate(org.apache.http.client.cache.HttpCacheContext clientContext)
    • flushEntriesInvalidatedByRequest

      private void flushEntriesInvalidatedByRequest(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
    • generateCachedResponse

      private org.apache.http.HttpResponse generateCachedResponse(org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
    • handleRevalidationFailure

      private org.apache.http.HttpResponse handleRevalidationFailure(org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
    • generateGatewayTimeout

      private org.apache.http.HttpResponse generateGatewayTimeout(org.apache.http.client.cache.HttpCacheContext clientContext)
    • unvalidatedCacheHit

      private org.apache.http.HttpResponse unvalidatedCacheHit(org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheEntry entry)
    • staleResponseNotAllowed

      private boolean staleResponseNotAllowed(org.apache.http.HttpRequest request, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
    • mayCallBackend

      private boolean mayCallBackend(org.apache.http.HttpRequest request)
    • explicitFreshnessRequest

      private boolean explicitFreshnessRequest(org.apache.http.HttpRequest request, org.apache.http.client.cache.HttpCacheEntry entry, Date now)
    • generateViaHeader

      private String generateViaHeader(org.apache.http.HttpMessage msg)
    • setResponseStatus

      private void setResponseStatus(org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.CacheResponseStatus value)
    • supportsRangeAndContentRangeHeaders

      public boolean supportsRangeAndContentRangeHeaders()
      Reports whether this CachingHttpClient implementation supports byte-range requests as specified by the Range and Content-Range headers.
      Returns:
      true if byte-range requests are supported
    • isSharedCache

      public boolean isSharedCache()
      Reports whether this CachingHttpClient is configured as a shared (public) or non-shared (private) cache. See CacheConfig.setSharedCache(boolean).
      Returns:
      true if we are behaving as a shared (public) cache
    • getCurrentDate

      Date getCurrentDate()
    • clientRequestsOurOptions

      boolean clientRequestsOurOptions(org.apache.http.HttpRequest request)
    • callBackend

      void callBackend(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext)
    • revalidationResponseIsTooOld

      private boolean revalidationResponseIsTooOld(org.apache.http.HttpResponse backendResponse, org.apache.http.client.cache.HttpCacheEntry cacheEntry)
    • negotiateResponseFromVariants

      void negotiateResponseFromVariants(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, Map<String,org.apache.http.impl.client.cache.Variant> variants)
    • retryRequestUnconditionally

      private void retryRequestUnconditionally(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry matchedEntry)
    • getUpdatedVariantEntry

      private org.apache.http.client.cache.HttpCacheEntry getUpdatedVariantEntry(org.apache.http.HttpHost target, org.apache.http.HttpRequest conditionalRequest, Date requestDate, Date responseDate, org.apache.http.HttpResponse backendResponse, org.apache.http.impl.client.cache.Variant matchingVariant, org.apache.http.client.cache.HttpCacheEntry matchedEntry)
    • tryToUpdateVariantMap

      private void tryToUpdateVariantMap(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.impl.client.cache.Variant matchingVariant)
    • shouldSendNotModifiedResponse

      private boolean shouldSendNotModifiedResponse(org.apache.http.HttpRequest request, org.apache.http.client.cache.HttpCacheEntry responseEntry)
    • revalidateCacheEntry

      void revalidateCacheEntry(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry cacheEntry) throws org.apache.http.ProtocolException
      Throws:
      org.apache.http.ProtocolException
    • revalidateCacheEntryCompleted

      private void revalidateCacheEntryCompleted(org.apache.http.concurrent.BasicFuture<org.apache.http.HttpResponse> future, org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, org.apache.http.client.cache.HttpCacheContext clientContext, org.apache.http.client.cache.HttpCacheEntry cacheEntry, org.apache.http.client.methods.HttpRequestWrapper conditionalRequest, Date requestDate, org.apache.http.HttpResponse httpResponse, Date responseDate)
    • staleIfErrorAppliesTo

      private boolean staleIfErrorAppliesTo(int statusCode)
    • handleBackendResponse

      org.apache.http.client.methods.CloseableHttpResponse handleBackendResponse(org.apache.http.HttpHost target, org.apache.http.client.methods.HttpRequestWrapper request, Date requestDate, Date responseDate, org.apache.http.client.methods.CloseableHttpResponse backendResponse) throws IOException
      Throws:
      IOException
    • storeRequestIfModifiedSinceFor304Response

      private void storeRequestIfModifiedSinceFor304Response(org.apache.http.HttpRequest request, org.apache.http.HttpResponse backendResponse)
      For 304 Not modified responses, adds a "Last-Modified" header with the value of the "If-Modified-Since" header passed in the request. This header is required to be able to reuse match the cache entry for subsequent requests but as defined in http specifications it is not included in 304 responses by backend servers. This header will not be included in the resulting response.
    • alreadyHaveNewerCacheEntry

      private boolean alreadyHaveNewerCacheEntry(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.HttpResponse backendResponse)