Class URLResource
java.lang.Object
io.undertow.server.handlers.resource.URLResource
- All Implemented Interfaces:
RangeAwareResource,Resource
- Author:
- Stuart Douglas
-
Constructor Summary
ConstructorsConstructorDescriptionURLResource(URL url, String path) URLResource(URL url, URLConnection connection, String path) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptiongetContentType(MimeMappings mimeMappings) Return the resources content type.getETag()getFile()getName()getPath()Returns the resource manager root.Returns the resource manager root.getUrl()booleanbooleanIt is possible that some resources managers may only support range requests on a subset of their resources,list()voidserveAsync(OutputChannel stream, HttpServerExchange exchange) voidserveBlocking(OutputStream sender, HttpServerExchange exchange) voidserveImpl(OutputChannel stream, HttpServerExchange exchange, long start, long end, boolean range) voidserveRangeAsync(OutputChannel outputStream, HttpServerExchange exchange, long start, long end) Serve the resource, and call the provided callback when complete.voidserveRangeBlocking(OutputStream sender, HttpServerExchange exchange, long start, long end) Serve the resource, and call the provided callback when complete.
-
Constructor Details
-
URLResource
Deprecated. -
URLResource
-
-
Method Details
-
getPath
-
getLastModified
- Specified by:
getLastModifiedin interfaceResource- Returns:
- The last modified date of this resource, or null if this cannot be determined
-
getLastModifiedString
- Specified by:
getLastModifiedStringin interfaceResource- Returns:
- A string representation of the last modified date, or null if this cannot be determined
-
getETag
-
getName
-
isDirectory
public boolean isDirectory()- Specified by:
isDirectoryin interfaceResource- Returns:
trueif this resource represents a directory
-
list
-
getContentType
Description copied from interface:ResourceReturn the resources content type. In most cases this will simply use the provided mime mappings, however in some cases the resource may have additional information as to the actual content type.- Specified by:
getContentTypein interfaceResource
-
serveBlocking
- Specified by:
serveBlockingin interfaceResourceexchange- The exchange- Throws:
IOException
-
serveAsync
- Specified by:
serveAsyncin interfaceResourceexchange- The exchange
-
serveImpl
public void serveImpl(OutputChannel stream, HttpServerExchange exchange, long start, long end, boolean range) -
getContentLength
- Specified by:
getContentLengthin interfaceResource- Returns:
- The content length, or null if it is unknown
-
getCacheKey
- Specified by:
getCacheKeyin interfaceResource- Returns:
- A string that uniquely identifies this resource
-
getFile
-
getFilePath
- Specified by:
getFilePathin interfaceResource- Returns:
- The underlying file that matches the resource. This may return null if the resource does not map to a file
-
getResourceManagerRoot
Description copied from interface:ResourceReturns the resource manager root. If the resource manager has multiple roots then this returns the one that is the parent of this resource.- Specified by:
getResourceManagerRootin interfaceResource- Returns:
- a file representing the resource manager root. This may return null if the resource does not map to a file
-
getResourceManagerRootPath
Description copied from interface:ResourceReturns the resource manager root. If the resource manager has multiple roots then this returns the one that is the parent of this resource.- Specified by:
getResourceManagerRootPathin interfaceResource- Returns:
- a path representing the resource manager root. This may return null if the resource does not map to a file
-
getUrl
-
serveRangeBlocking
public void serveRangeBlocking(OutputStream sender, HttpServerExchange exchange, long start, long end) throws IOException Description copied from interface:RangeAwareResourceServe the resource, and call the provided callback when complete.- Specified by:
serveRangeBlockingin interfaceRangeAwareResource- Parameters:
sender- The sender to use.exchange- The exchange- Throws:
IOException
-
serveRangeAsync
public void serveRangeAsync(OutputChannel outputStream, HttpServerExchange exchange, long start, long end) Description copied from interface:RangeAwareResourceServe the resource, and call the provided callback when complete.- Specified by:
serveRangeAsyncin interfaceRangeAwareResource- Parameters:
outputStream- The sender to use.exchange- The exchange
-
isRangeSupported
public boolean isRangeSupported()Description copied from interface:RangeAwareResourceIt is possible that some resources managers may only support range requests on a subset of their resources,- Specified by:
isRangeSupportedin interfaceRangeAwareResource- Returns:
trueif this resource supports range requests
-