public class CachedResource extends Object implements Resource, RangeAwareResource
| Constructor and Description |
|---|
CachedResource(CachingResourceManager cachingResourceManager,
Resource underlyingResource,
String path) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkStillValid() |
String |
getCacheKey() |
Long |
getContentLength() |
String |
getContentType(MimeMappings mimeMappings)
Return the resources content type.
|
ETag |
getETag() |
File |
getFile() |
Path |
getFilePath() |
Date |
getLastModified() |
String |
getLastModifiedString() |
String |
getName() |
String |
getPath() |
File |
getResourceManagerRoot()
Returns the resource manager root.
|
Path |
getResourceManagerRootPath()
Returns the resource manager root.
|
URL |
getUrl() |
void |
invalidate() |
boolean |
isDirectory() |
boolean |
isRangeSupported()
It is possible that some resources managers may only support range requests on a subset of their resources,
|
List<Resource> |
list() |
void |
serveAsync(OutputChannel stream,
HttpServerExchange exchange) |
void |
serveBlocking(OutputStream outputStream,
HttpServerExchange exchange) |
void |
serveRangeAsync(OutputChannel sender,
HttpServerExchange exchange,
long start,
long end)
Serve the resource, and call the provided callback when complete.
|
void |
serveRangeBlocking(OutputStream outputStream,
HttpServerExchange exchange,
long start,
long end)
Serve the resource, and call the provided callback when complete.
|
public CachedResource(CachingResourceManager cachingResourceManager, Resource underlyingResource, String path)
public String getPath()
public Date getLastModified()
getLastModified in interface Resourcepublic String getLastModifiedString()
getLastModifiedString in interface Resourcepublic ETag getETag()
public String getName()
public boolean isDirectory()
isDirectory in interface Resourcetrue if this resource represents a directorypublic String getContentType(MimeMappings mimeMappings)
ResourcegetContentType in interface Resourcepublic void serveBlocking(OutputStream outputStream, HttpServerExchange exchange) throws IOException
serveBlocking in interface Resourceexchange - The exchangeIOExceptionpublic void serveAsync(OutputChannel stream, HttpServerExchange exchange)
serveAsync in interface Resourceexchange - The exchangepublic void invalidate()
public boolean checkStillValid()
public Long getContentLength()
getContentLength in interface Resourcepublic String getCacheKey()
getCacheKey in interface Resourcepublic File getFile()
public Path getFilePath()
getFilePath in interface Resourcepublic File getResourceManagerRoot()
ResourcegetResourceManagerRoot in interface Resourcepublic Path getResourceManagerRootPath()
ResourcegetResourceManagerRootPath in interface Resourcepublic URL getUrl()
public void serveRangeBlocking(OutputStream outputStream, HttpServerExchange exchange, long start, long end) throws IOException
RangeAwareResourceserveRangeBlocking in interface RangeAwareResourceoutputStream - The sender to use.exchange - The exchangeIOExceptionpublic void serveRangeAsync(OutputChannel sender, HttpServerExchange exchange, long start, long end)
RangeAwareResourceserveRangeAsync in interface RangeAwareResourcesender - The sender to use.exchange - The exchangepublic boolean isRangeSupported()
RangeAwareResourceisRangeSupported in interface RangeAwareResourcetrue if this resource supports range requestsCopyright © 2020 JBoss by Red Hat. All rights reserved.