org.apache.http.impl.client.cache
Class CacheEntry
java.lang.Object
org.apache.http.impl.client.cache.CacheEntry
- All Implemented Interfaces:
- Serializable
@Immutable
public class CacheEntry
- extends Object
- implements Serializable
Structure used to store an HttpResponse
in a cache
- Since:
- 4.1
- See Also:
- Serialized Form
MAX_AGE
public static final long MAX_AGE
- See Also:
- Constant Field Values
CacheEntry
public CacheEntry(Date requestDate,
Date responseDate,
ProtocolVersion version,
Header[] responseHeaders,
HttpEntity body,
int status,
String reason)
- Create a new
CacheEntry
- Parameters:
requestDate
- Date/time when the request was made (Used for age
calculations)responseDate
- Date/time that the response came back (Used for age
calculations)version
- HTTP Response VersionresponseHeaders
- Header[] from original HTTP Responsebody
- HttpEntity representing the body of the responsestatus
- Numeric HTTP Status Codereason
- String message from HTTP Status Line
addVariantURI
public CacheEntry addVariantURI(String variantURI)
getProtocolVersion
public ProtocolVersion getProtocolVersion()
getReasonPhrase
public String getReasonPhrase()
getStatusCode
public int getStatusCode()
getRequestDate
public Date getRequestDate()
getResponseDate
public Date getResponseDate()
getBody
public HttpEntity getBody()
getAllHeaders
public Header[] getAllHeaders()
getFirstHeader
public Header getFirstHeader(String name)
getHeaders
public Header[] getHeaders(String name)
getDateValue
protected Date getDateValue()
getContentLengthValue
protected long getContentLengthValue()
contentLengthHeaderMatchesActualLength
protected boolean contentLengthHeaderMatchesActualLength()
- This matters for deciding whether the cache entry is valid to serve as a
response. If these values do not match, we might have a partial response
- Returns:
- boolean indicating whether actual length matches Content-Length
getApparentAgeSecs
protected long getApparentAgeSecs()
getAgeValue
protected long getAgeValue()
getCorrectedReceivedAgeSecs
protected long getCorrectedReceivedAgeSecs()
getResponseDelaySecs
protected long getResponseDelaySecs()
getCorrectedInitialAgeSecs
protected long getCorrectedInitialAgeSecs()
getCurrentDate
protected Date getCurrentDate()
getResidentTimeSecs
protected long getResidentTimeSecs()
getCurrentAgeSecs
public long getCurrentAgeSecs()
getMaxAge
protected long getMaxAge()
getExpirationDate
protected Date getExpirationDate()
getFreshnessLifetimeSecs
public long getFreshnessLifetimeSecs()
isResponseFresh
public boolean isResponseFresh()
isRevalidatable
public boolean isRevalidatable()
- Returns:
- boolean indicating whether ETag or Last-Modified responseHeaders
are present
modifiedSince
public boolean modifiedSince(HttpRequest request)
hasVariants
public boolean hasVariants()
- Returns:
- boolean indicating whether any Vary responseHeaders are present
getVariantURIs
public Set<String> getVariantURIs()
toString
public String toString()
- Overrides:
toString
in class Object
hasCacheControlDirective
protected boolean hasCacheControlDirective(String directive)
mustRevalidate
public boolean mustRevalidate()
proxyRevalidate
public boolean proxyRevalidate()
Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.