@Contract(threading=IMMUTABLE) public class HttpCacheEntry extends Object implements MessageHeaders, Serializable
HttpResponse in a cache.
 Some entries can optionally depend on system resources that may require
 explicit deallocation. In such a case getResource() should return
 a non null instance of Resource that must be deallocated by calling
 Resource.dispose() method when no longer used.| Constructor and Description | 
|---|
| HttpCacheEntry(Date requestDate,
              Date responseDate,
              int status,
              Header[] responseHeaders,
              Resource resource) | 
| HttpCacheEntry(Date requestDate,
              Date responseDate,
              int status,
              Header[] responseHeaders,
              Resource resource,
              Map<String,String> variantMap)Deprecated. 
 | 
| HttpCacheEntry(Instant requestDate,
              Instant responseDate,
              int status,
              Header[] responseHeaders,
              Resource resource)Create a new  HttpCacheEntry. | 
| HttpCacheEntry(Instant requestDate,
              Instant responseDate,
              int status,
              Header[] responseHeaders,
              Resource resource,
              Map<String,String> variantMap)Create a new  HttpCacheEntrywith variants. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | containsHeader(String name) | 
| int | countHeaders(String name) | 
| Date | getDate()Gets the Date value of the "Date" header or null if the header is missing or cannot be
 parsed. | 
| Header | getFirstHeader(String name)Returns the first header from the origin response with the given
 name. | 
| Header | getHeader(String name) | 
| Header[] | getHeaders()Returns all the headers that were on the origin response. | 
| Header[] | getHeaders(String name)Gets all the headers with the given name that were on the origin
 response. | 
| Instant | getInstant() | 
| Header | getLastHeader(String name) | 
| Date | getRequestDate()Deprecated. 
 | 
| Instant | getRequestInstant()Returns the time the associated origin request was initiated by the
 caching module. | 
| String | getRequestMethod()Returns the HTTP request method that was used to create the cached
 response entry. | 
| Resource | getResource()Returns the  Resourcecontaining the origin response body. | 
| Date | getResponseDate()Deprecated. 
 | 
| Instant | getResponseInstant()Returns the time the origin response was received by the caching module. | 
| int | getStatus()Returns the status from the origin  HttpResponse. | 
| Map<String,String> | getVariantMap()Returns an index about where in the cache different variants for
 a given resource are stored. | 
| boolean | hasVariants()Indicates whether the origin response indicated the associated
 resource had variants (i.e. | 
| Iterator<Header> | headerIterator() | 
| Iterator<Header> | headerIterator(String name) | 
| String | toString()Provides a string representation of this instance suitable for
 human consumption. | 
@Deprecated public HttpCacheEntry(Date requestDate, Date responseDate, int status, Header[] responseHeaders, Resource resource, Map<String,String> variantMap)
HttpCacheEntry(Instant, Instant, int, Header[], Resource, Map)}HttpCacheEntry with variants.requestDate - Date/time when the request was made (Used for age
            calculations)responseDate - Date/time that the response came back (Used for age
            calculations)status - HTTP status from origin responseresponseHeaders - Header[] from original HTTP Responseresource - representing origin response bodyvariantMap - describing cache entries that are variants
   of this parent entry; this maps a "variant key" (derived
   from the varying request headers) to a "cache key" (where
   in the cache storage the particular variant is located)public HttpCacheEntry(Instant requestDate, Instant responseDate, int status, Header[] responseHeaders, Resource resource, Map<String,String> variantMap)
HttpCacheEntry with variants.requestDate - Date/time when the request was made (Used for age calculations)responseDate - Date/time that the response came back (Used for age calculations)status - HTTP status from origin responseresponseHeaders - Header[] from original HTTP Responseresource - representing origin response bodyvariantMap - describing cache entries that are variants of this parent entry; this
                        maps a "variant key" (derived from the varying request headers) to a
                        "cache key" (where in the cache storage the particular variant is
                        located)@Deprecated public HttpCacheEntry(Date requestDate, Date responseDate, int status, Header[] responseHeaders, Resource resource)
HttpCacheEntry.requestDate - Date/time when the request was made (Used for age calculations)responseDate - Date/time that the response came back (Used for age calculations)status - HTTP status from origin responseresponseHeaders - Header[] from original HTTP Responseresource - representing origin response bodypublic HttpCacheEntry(Instant requestDate, Instant responseDate, int status, Header[] responseHeaders, Resource resource)
HttpCacheEntry.requestDate - Date/time when the request was made (Used for age
            calculations)responseDate - Date/time that the response came back (Used for age
            calculations)status - HTTP status from origin responseresponseHeaders - Header[] from original HTTP Responseresource - representing origin response bodypublic int getStatus()
HttpResponse.@Deprecated public Date getRequestDate()
getRequestInstant()Datepublic Instant getRequestInstant()
Instant@Deprecated public Date getResponseDate()
getResponseInstant()Datepublic Instant getResponseInstant()
Instantpublic Header[] getHeaders()
getHeaders in interface MessageHeaderspublic Header getFirstHeader(String name)
getFirstHeader in interface MessageHeaderspublic Header getLastHeader(String name)
getLastHeader in interface MessageHeaderspublic Header[] getHeaders(String name)
getHeaders in interface MessageHeaderspublic boolean containsHeader(String name)
containsHeader in interface MessageHeaderspublic int countHeaders(String name)
countHeaders in interface MessageHeaderspublic Header getHeader(String name) throws ProtocolException
getHeader in interface MessageHeadersProtocolExceptionpublic Iterator<Header> headerIterator()
headerIterator in interface MessageHeaderspublic Iterator<Header> headerIterator(String name)
headerIterator in interface MessageHeaderspublic Date getDate()
public Instant getInstant()
public boolean hasVariants()
true if this cached response was a variantpublic Map<String,String> getVariantMap()
HttpCacheStorage where that
 particular variant is stored. The first variant returned is used as
 the "parent" entry to hold this index of the other variants.public String getRequestMethod()
Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.