Top Fields Constructors Methods
io.undertow.server.handlers.resource

public Class URLResource

extends Object
implements Resource, RangeAwareResource
Class Inheritance
All Implemented Interfaces
io.undertow.server.handlers.resource.RangeAwareResource, io.undertow.server.handlers.resource.Resource
Imports
java.io.File, .IOException, .InputStream, java.net.JarURLConnection, .URISyntaxException, .URL, .URLConnection, java.nio.ByteBuffer, java.nio.file.DirectoryStream, .Files, .Path, .Paths, java.util.Date, .LinkedList, .List, org.xnio.IoUtils, io.undertow.UndertowLogger, io.undertow.io.IoCallback, .Sender, io.undertow.server.HttpServerExchange, io.undertow.util.DateUtils, .ETag, .MimeMappings, .StatusCodes

Author
Stuart Douglas

Field Summary

Modifier and TypeField and Description
private boolean
private Long
private Date
private final String
private final URL

Constructor Summary

AccessConstructor and Description
public
URLResource(final URL url, URLConnection connection, String path)
Deprecated

public
URLResource(final URL url, String path)

Method Summary

Modifier and TypeMethod and Description
public String
public Long
public String
getContentType(final MimeMappings mimeMappings)

Implements io.undertow.server.handlers.resource.Resource.getContentType.

Return the resources content type.

public ETag
public File
public Path
public Date
public String
public String
public String
public File
public Path
public URL
public boolean
public boolean
isRangeSupported()

Implements io.undertow.server.handlers.resource.RangeAwareResource.isRangeSupported.

It is possible that some resources managers may only support range requests on a subset of their resources,

public List<Resource>
private void
public void
serve(Sender
The sender to use.
sender
,
HttpServerExchange
The exchange
exchange
,
IoCallback completionCallback)

Implements io.undertow.server.handlers.resource.Resource.serve.

Serve the resource, and call the provided callback when complete.

public void
serveImpl(final Sender sender, final HttpServerExchange exchange, final long start, final long end, final boolean range, final IoCallback completionCallback)

public void
serveRange(Sender
The sender to use.
sender
,
HttpServerExchange
The exchange
exchange
,
long start, long end, IoCallback completionCallback)

Implements io.undertow.server.handlers.resource.RangeAwareResource.serveRange.

Serve the resource, and call the provided callback when complete.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionOpenedback to summary
private boolean connectionOpened
contentLengthback to summary
private Long contentLength
lastModifiedback to summary
private Date lastModified
pathback to summary
private final String path
urlback to summary
private final URL url

Constructor Detail

URLResourceback to summary
public URLResource(final URL url, URLConnection connection, String path)

Deprecated

Annotations
@Deprecated
URLResourceback to summary
public URLResource(final URL url, String path)

Method Detail

getCacheKeyback to summary
public String getCacheKey()

Implements io.undertow.server.handlers.resource.Resource.getCacheKey.

Returns:String

Doc from io.undertow.server.handlers.resource.Resource.getCacheKey.

A string that uniquely identifies this resource

Annotations
@Override
getContentLengthback to summary
public Long getContentLength()

Implements io.undertow.server.handlers.resource.Resource.getContentLength.

Returns:Long

Doc from io.undertow.server.handlers.resource.Resource.getContentLength.

The content length, or null if it is unknown

Annotations
@Override
getContentTypeback to summary
public String getContentType(final MimeMappings mimeMappings)

Implements io.undertow.server.handlers.resource.Resource.getContentType.

Doc from io.undertow.server.handlers.resource.Resource.getContentType.

Return 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.

Annotations
@Override
getETagback to summary
public ETag getETag()

Implements io.undertow.server.handlers.resource.Resource.getETag.

Returns:ETag

Doc from io.undertow.server.handlers.resource.Resource.getETag.

The resources etags

Annotations
@Override
getFileback to summary
public File getFile()

Implements io.undertow.server.handlers.resource.Resource.getFile.

Returns:File

Doc from io.undertow.server.handlers.resource.Resource.getFile.

The underlying file that matches the resource. This may return null if the resource does not map to a file

Annotations
@Override
getFilePathback to summary
public Path getFilePath()

Implements io.undertow.server.handlers.resource.Resource.getFilePath.

Returns:Path

Doc from io.undertow.server.handlers.resource.Resource.getFilePath.

The underlying file that matches the resource. This may return null if the resource does not map to a file

Annotations
@Override
getLastModifiedback to summary
public Date getLastModified()

Implements io.undertow.server.handlers.resource.Resource.getLastModified.

Returns:Date

Doc from io.undertow.server.handlers.resource.Resource.getLastModified.

The last modified date of this resource, or null if this cannot be determined

Annotations
@Override
getLastModifiedStringback to summary
public String getLastModifiedString()

Implements io.undertow.server.handlers.resource.Resource.getLastModifiedString.

Returns:String

Doc from io.undertow.server.handlers.resource.Resource.getLastModifiedString.

A string representation of the last modified date, or null if this cannot be determined

Annotations
@Override
getNameback to summary
public String getName()

Implements io.undertow.server.handlers.resource.Resource.getName.

Returns:String

Doc from io.undertow.server.handlers.resource.Resource.getName.

The name of the resource

Annotations
@Override
getPathback to summary
public String getPath()

Implements io.undertow.server.handlers.resource.Resource.getPath.

Returns:String

Doc from io.undertow.server.handlers.resource.Resource.getPath.

The path from the resource manager root

Annotations
@Override
getResourceManagerRootback to summary
public File getResourceManagerRoot()

Implements io.undertow.server.handlers.resource.Resource.getResourceManagerRoot.

Doc from io.undertow.server.handlers.resource.Resource.getResourceManagerRoot.

Returns the resource manager root. If the resource manager has multiple roots then this returns the one that is the parent of this resource.

Returns:File

a file representing the resource manager root. This may return null if the resource does not map to a file

Annotations
@Override
getResourceManagerRootPathback to summary
public Path getResourceManagerRootPath()

Implements io.undertow.server.handlers.resource.Resource.getResourceManagerRootPath.

Doc from io.undertow.server.handlers.resource.Resource.getResourceManagerRootPath.

Returns the resource manager root. If the resource manager has multiple roots then this returns the one that is the parent of this resource.

Returns:Path

a path representing the resource manager root. This may return null if the resource does not map to a file

Annotations
@Override
getUrlback to summary
public URL getUrl()

Implements io.undertow.server.handlers.resource.Resource.getUrl.

Returns:URL

Doc from io.undertow.server.handlers.resource.Resource.getUrl.

The URL of the resource

Annotations
@Override
isDirectoryback to summary
public boolean isDirectory()

Implements io.undertow.server.handlers.resource.Resource.isDirectory.

Returns:boolean

Doc from io.undertow.server.handlers.resource.Resource.isDirectory.

true if this resource represents a directory

Annotations
@Override
isRangeSupportedback to summary
public boolean isRangeSupported()

Implements io.undertow.server.handlers.resource.RangeAwareResource.isRangeSupported.

Doc from io.undertow.server.handlers.resource.RangeAwareResource.isRangeSupported.

It is possible that some resources managers may only support range requests on a subset of their resources,

Returns:boolean

true if this resource supports range requests

Annotations
@Override
listback to summary
public List<Resource> list()

Implements io.undertow.server.handlers.resource.Resource.list.

Returns:List<Resource>

Doc from io.undertow.server.handlers.resource.Resource.list.

a list of resources in this directory

Annotations
@Override
openConnectionback to summary
private void openConnection()
serveback to summary
public void serve(Sender sender, HttpServerExchange exchange, IoCallback completionCallback)

Implements io.undertow.server.handlers.resource.Resource.serve.

Doc from io.undertow.server.handlers.resource.Resource.serve.

Serve the resource, and call the provided callback when complete.

Parameters
sender:Sender

The sender to use.

exchange:HttpServerExchange

The exchange

Annotations
@Override
serveImplback to summary
public void serveImpl(final Sender sender, final HttpServerExchange exchange, final long start, final long end, final boolean range, final IoCallback completionCallback)
serveRangeback to summary
public void serveRange(Sender sender, HttpServerExchange exchange, long start, long end, IoCallback completionCallback)

Implements io.undertow.server.handlers.resource.RangeAwareResource.serveRange.

Doc from io.undertow.server.handlers.resource.RangeAwareResource.serveRange.

Serve the resource, and call the provided callback when complete.

Parameters
sender:Sender

The sender to use.

exchange:HttpServerExchange

The exchange

Annotations
@Override