Class CachedHttpResponseGenerator


  • class CachedHttpResponseGenerator
    extends java.lang.Object
    Rebuilds an HttpResponse from a HttpCacheEntry
    • Constructor Detail

      • CachedHttpResponseGenerator

        CachedHttpResponseGenerator​(CacheValidityPolicy validityStrategy)
    • Method Detail

      • generateNotModifiedResponse

        SimpleHttpResponse generateNotModifiedResponse​(HttpCacheEntry entry)
        Generate a 304 - Not Modified response from the HttpCacheEntry. This should be used to respond to conditional requests, when the entry exists or has been re-validated.
      • addMissingContentLengthHeader

        private void addMissingContentLengthHeader​(org.apache.hc.core5.http.HttpResponse response,
                                                   byte[] body)
      • transferEncodingIsPresent

        private boolean transferEncodingIsPresent​(org.apache.hc.core5.http.HttpResponse response)
      • responseShouldContainEntity

        private boolean responseShouldContainEntity​(org.apache.hc.core5.http.HttpRequest request,
                                                    HttpCacheEntry cacheEntry)
      • getErrorForRequest

        public SimpleHttpResponse getErrorForRequest​(RequestProtocolError errorCheck)
        Extract error information about the HttpRequest telling the 'caller' that a problem occurred.
        Parameters:
        errorCheck - What type of error should I get
        Returns:
        The HttpResponse that is the error generated