public class URLResource extends Object implements Resource, RangeAwareResource
Constructor and Description |
---|
URLResource(URL url,
URLConnection connection,
String path) |
Modifier and Type | Method and Description |
---|---|
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() |
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 |
serve(Sender sender,
HttpServerExchange exchange,
IoCallback completionCallback)
Serve the resource, and call the provided callback when complete.
|
void |
serveImpl(Sender sender,
HttpServerExchange exchange,
long start,
long end,
boolean range,
IoCallback completionCallback) |
void |
serveRange(Sender sender,
HttpServerExchange exchange,
long start,
long end,
IoCallback completionCallback)
Serve the resource, and call the provided callback when complete.
|
public URLResource(URL url, URLConnection connection, String path)
public String getPath()
public Date getLastModified()
getLastModified
in interface Resource
public String getLastModifiedString()
getLastModifiedString
in interface Resource
public ETag getETag()
public String getName()
public boolean isDirectory()
isDirectory
in interface Resource
true
if this resource represents a directorypublic String getContentType(MimeMappings mimeMappings)
Resource
getContentType
in interface Resource
public void serve(Sender sender, HttpServerExchange exchange, IoCallback completionCallback)
Resource
public void serveImpl(Sender sender, HttpServerExchange exchange, long start, long end, boolean range, IoCallback completionCallback)
public Long getContentLength()
getContentLength
in interface Resource
public String getCacheKey()
getCacheKey
in interface Resource
public File getFile()
public Path getFilePath()
getFilePath
in interface Resource
public File getResourceManagerRoot()
Resource
getResourceManagerRoot
in interface Resource
public Path getResourceManagerRootPath()
Resource
getResourceManagerRootPath
in interface Resource
public URL getUrl()
public void serveRange(Sender sender, HttpServerExchange exchange, long start, long end, IoCallback completionCallback)
RangeAwareResource
serveRange
in interface RangeAwareResource
sender
- The sender to use.exchange
- The exchangepublic boolean isRangeSupported()
RangeAwareResource
isRangeSupported
in interface RangeAwareResource
true
if this resource supports range requestsCopyright © 2016 JBoss by Red Hat. All rights reserved.