public class CachedHttpEntity extends Object implements HttpEntity
The body and metadata of the origin entity are cached in memory. This is useful for frequently requested entities.
This entity is always sharable, whether the origin entity is sharable or not.
| Constructor and Description |
|---|
CachedHttpEntity(HttpEntity origin)
Create a cache of the origin entity.
|
| Instance Methods | |
|---|---|
ByteSource |
body()
The entity body.
|
ContentType |
contentType()
Return
"contentType" of the origin entity. |
Long |
contentLength()
The length of the body.
|
String |
contentEncoding()
Return
"contentEncoding" of the origin entity. |
Instant |
lastModified()
Return
"lastModified" of the origin entity. |
Instant |
expires()
Return
"expires" of the origin entity. |
String |
etag()
Return
"etag" of the origin entity. |
boolean |
etagIsWeak()
Return
"etagIsWeak" of the origin entity. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbodyBytes, bodyStringpublic CachedHttpEntity(HttpEntity origin)
public ByteSource body()
The returned ByteSource is based on an in-memory cache of the origin entity body.
See ByteSourceCache.
This entity is sharable, the body() method can be called multiple times.
body in interface HttpEntitypublic ContentType contentType()
"contentType" of the origin entity.contentType in interface HttpEntitypublic Long contentLength()
The length may be null/unknown initially;
however, it eventually becomes known after caching is done.
See ByteSourceCache.getTotalBytes().
contentLength in interface HttpEntitypublic String contentEncoding()
"contentEncoding" of the origin entity.contentEncoding in interface HttpEntitypublic Instant lastModified()
"lastModified" of the origin entity.lastModified in interface HttpEntitypublic Instant expires()
"expires" of the origin entity.expires in interface HttpEntitypublic String etag()
"etag" of the origin entity.etag in interface HttpEntitypublic boolean etagIsWeak()
"etagIsWeak" of the origin entity.etagIsWeak in interface HttpEntity