public interface StreamableResource
Resource
, that can be streamed (ultimately, to a client web browser). In addition,
a StreamableResource may be transformed (by the stack of interceptors around StreamableResourceSource
: this
includes transforming a Resource (example: CoffeeScript to JavaScript compilation), as well as aggregation
and compression.Modifier and Type | Method and Description |
---|---|
StreamableResource |
addResponseCustomizer(ResponseCustomizer customizer)
Returns a new StreamableResource that includes the provided customizer.
|
String |
getChecksum()
Compute and return the checksum of the content for this asset; the checksum should be computed
based on the uncompressed content.
|
CompressionStatus |
getCompression()
Indicates if the content is compressed, or compressable.
|
ContentType |
getContentType()
Returns the resource's content type.
|
String |
getDescription()
Describes the underlying
Resource (or resources} for this streamable resource; expressly used
as part of the object's toString() . |
long |
getLastModified()
Returns the time the resource was last modified, with accuracy to one second (so as to match
the HTTP request/response date headers).
|
ResponseCustomizer |
getResponseCustomizer()
Returns the customizer, if any, for this resource.
|
int |
getSize()
The size, in bytes, of the underlying bytestream.
|
InputStream |
openStream()
Opens the content of the resource as an input stream; the caller is responsible for closing the stream
after reading it.
|
void |
streamTo(OutputStream os)
Streams the resource's content to the provided stream.
|
StreamableResource |
withContentType(ContentType newContentType)
Returns a new StreamableResource instance with the new content type.
|
String getDescription()
Resource
(or resources} for this streamable resource; expressly used
as part of the object's toString()
.CompressionStatus getCompression()
@IncompatibleChange(release="5.4", details="Changed from type String to ContentType") ContentType getContentType()
int getSize()
void streamTo(OutputStream os) throws IOException
IOException
InputStream openStream() throws IOException
IOException
long getLastModified()
String getChecksum() throws IOException
IOException
AssetChecksumGenerator.generateChecksum(StreamableResource)
StreamableResource addResponseCustomizer(ResponseCustomizer customizer)
ResponseCustomizer getResponseCustomizer()
StreamableResource withContentType(ContentType newContentType)
newContentType
- 5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.