Class CacheEntryUpdater


  • @Contract(threading=IMMUTABLE_CONDITIONAL)
    class CacheEntryUpdater
    extends java.lang.Object
    Update a HttpCacheEntry with new or updated information based on the latest 304 status response from the Server. Use the HttpResponse to perform the update.
    Since:
    4.1
    • Constructor Detail

      • CacheEntryUpdater

        CacheEntryUpdater()
    • Method Detail

      • updateCacheEntry

        public HttpCacheEntry updateCacheEntry​(java.lang.String requestId,
                                               HttpCacheEntry entry,
                                               java.util.Date requestDate,
                                               java.util.Date responseDate,
                                               org.apache.http.HttpResponse response)
                                        throws java.io.IOException
        Update the entry with the new information from the response. Should only be used for 304 responses.
        Parameters:
        requestId -
        entry - The cache Entry to be updated
        requestDate - When the request was performed
        responseDate - When the response was gotten
        response - The HttpResponse from the backend server call
        Returns:
        HttpCacheEntry an updated version of the cache entry
        Throws:
        java.io.IOException - if something bad happens while trying to read the body from the original entry
      • mergeHeaders

        protected org.apache.http.Header[] mergeHeaders​(HttpCacheEntry entry,
                                                        org.apache.http.HttpResponse response)
      • entryDateHeaderNewerThenResponse

        private boolean entryDateHeaderNewerThenResponse​(HttpCacheEntry entry,
                                                         org.apache.http.HttpResponse response)
      • entryAndResponseHaveDateHeader

        private boolean entryAndResponseHaveDateHeader​(HttpCacheEntry entry,
                                                       org.apache.http.HttpResponse response)