Interface HttpContent
- All Known Subinterfaces:
CachingHttpContentFactory.CachingHttpContent
- All Known Implementing Classes:
CachingHttpContentFactory.CachedHttpContent
,CachingHttpContentFactory.NotFoundHttpContent
,HttpContent.Wrapper
,PreCompressedHttpContent
,ResourceHttpContent
,ValidatingCachingHttpContentFactory.ValidatingCachedContent
,ValidatingCachingHttpContentFactory.ValidatingNotFoundContent
public interface HttpContent
The HttpContent
interface represents all the information about a
static Resource
that is needed to evaluate conditional headers
and to eventually serve the actual content.
It can be implemented either transiently (values and fields generated on
demand) or persistently (values and fields pre-generated in anticipation
of reuse in from a cache).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Factory ofHttpContent
.static class
HttpContent Wrapper. -
Method Summary
Modifier and TypeMethodDescriptionGet the character encoding of this HTTP content.Get theHttpHeader.CONTENT_ENCODING
of this HTTP content.default String
Get theHttpHeader.CONTENT_LENGTH
of this HTTP content.long
Get the content length of this resource.Get theHttpHeader.CONTENT_TYPE
of this HTTP content.default String
getETag()
Get theHttpHeader.ETAG
of this HTTP content.default String
Get theHttpHeader.LAST_MODIFIED
of this HTTP content.Get the last modified instant of this resource.Get the Mime type of this HTTP content.Get available pre-compressed formats for this content.Get theResource
backing this HTTP content.void
writeTo
(Content.Sink sink, long offset, long length, Callback callback) Asynchronously write a subset of this HTTP content to aContent.Sink
.
-
Method Details
-
getContentType
HttpField getContentType()Get theHttpHeader.CONTENT_TYPE
of this HTTP content.- Returns:
- the content type field, or null if the type of this content is not known.
-
getContentEncoding
HttpField getContentEncoding()Get theHttpHeader.CONTENT_ENCODING
of this HTTP content.- Returns:
- the content encoding field, or null if the encoding of this content is not known.
-
getContentLength
HttpField getContentLength()Get theHttpHeader.CONTENT_LENGTH
of this HTTP content. The value of the returned field must always match the value returned bygetContentLengthValue()
.- Returns:
- the content length field, or null if the length of this content is not known.
-
getLastModified
HttpField getLastModified()Get theHttpHeader.LAST_MODIFIED
of this HTTP content. The value of the returned field must always match the value returned bygetLastModifiedInstant()
.- Returns:
- the last modified field, or null if the last modification time of this content is not known.
-
getETag
HttpField getETag()Get theHttpHeader.ETAG
of this HTTP content.- Returns:
- the ETag, or null if this content has no ETag.
-
getCharacterEncoding
String getCharacterEncoding()Get the character encoding of this HTTP content.- Returns:
- the character encoding, or null if the character encoding of this content is not known.
-
getMimeType
MimeTypes.Type getMimeType()Get the Mime type of this HTTP content.- Returns:
- the mime type, or null if the mime type of this content is not known.
-
getLastModifiedInstant
Instant getLastModifiedInstant()Get the last modified instant of this resource.- Returns:
- the last modified instant, or null if that instant of this content is not known.
- See Also:
-
getContentLengthValue
long getContentLengthValue()Get the content length of this resource.- Returns:
- the content length of this resource, or -1 if it is not known.
- See Also:
-
getResource
-
writeTo
Asynchronously write a subset of this HTTP content to aContent.Sink
. Calling this method does not consume the content, so it can be used repeatedly.- Parameters:
sink
- the sink to write to.offset
- the offset byte of the resource to start from.length
- the length of the resource's contents to copy, -1 for the full length.callback
- the callback to notify when writing is done.
-
getPreCompressedContentFormats
Set<CompressedContentFormat> getPreCompressedContentFormats()Get available pre-compressed formats for this content.- Returns:
- Set of available pre-compressed formats for this content, or null if this has not been checked.
-
getContentTypeValue
-
getContentEncodingValue
-
getETagValue
-