public interface ResourceStreamer
Resource
(often from the ModuleDispatcher
,
or more frequently an asset represented as a StreamableResource
(via AssetDispatcher
, AssetRequestHandler
,
and StreamableResourceSource
). As of 5.4, the ResourceStreamer handles ETag support, as well as
validation of the checksum (provided in the URL).Modifier and Type | Interface and Description |
---|---|
static class |
ResourceStreamer.Options
Used to customize the behavior of
streamResource(org.apache.tapestry5.ioc.Resource, java.lang.String, java.util.Set) . |
Modifier and Type | Field and Description |
---|---|
static Set<ResourceStreamer.Options> |
DEFAULT_OPTIONS |
Modifier and Type | Method and Description |
---|---|
boolean |
streamResource(Resource resource,
String providedChecksum,
Set<ResourceStreamer.Options> options)
Streams the content of the resource to the client (or sends
an alternative response such as
HttpServletResponse.SC_NOT_MODIFIED ). |
boolean |
streamResource(StreamableResource resource,
String providedChecksum,
Set<ResourceStreamer.Options> options)
Streams a resource that has been assembled elsewhere.
|
static final Set<ResourceStreamer.Options> DEFAULT_OPTIONS
boolean streamResource(Resource resource, String providedChecksum, Set<ResourceStreamer.Options> options) throws IOException
HttpServletResponse.SC_NOT_MODIFIED
). Encapsulates logic for compression
and for caching.resource
- to streamprovidedChecksum
- checksum from URL (or null to not validate against checksum, which is normal for modules)options
- enable or disable certain featuresIOException
StreamableResourceSource
boolean streamResource(StreamableResource resource, String providedChecksum, Set<ResourceStreamer.Options> options) throws IOException
resource
- content to streamprovidedChecksum
- checksum provided (in the URL) to validate against the StreamableResource.getChecksum() actual checksum}
for the resource, may be blank to not validate against the checksumoptions
- enable or disable certain featuresHttpServletResponse.SC_NOT_MODIFIED
response),
or false if the request was not handled (because the provided checksum did not match the actual checksum).IOException
5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.