Top Description Methods
io.undertow.server.handlers.resource

public Interface Resource

Known Direct Subinterfaces
io.undertow.server.handlers.resource.RangeAwareResource
Known Direct Implementers
io.undertow.server.handlers.resource.URLResource, io.undertow.server.handlers.resource.CachedResource
Imports
java.io.File, java.net.URL, java.nio.file.Path, java.util.Date, .List, io.undertow.io.IoCallback, .Sender, io.undertow.server.HttpServerExchange, io.undertow.util.ETag, .MimeMappings

Representation of a static resource.
Author
Stuart Douglas

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

A string that uniquely identifies this resource
getCacheKey
()

public Long

Returns:

The content length, or null if it is unknown
getContentLength
()

public String
getContentType(final MimeMappings mimeMappings)

Return the resources content type.

public ETag

Returns:

The resources etags
getETag
()

public File

Returns:

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

public Path

Returns:

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

public Date

Returns:

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

public String

Returns:

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

public String

Returns:

The name of the resource
getName
()

public String

Returns:

The path from the resource manager root
getPath
()

public File

Returns:

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

Returns the resource manager root.

public Path

Returns:

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

Returns the resource manager root.

public URL

Returns:

The URL of the resource
getUrl
()

public boolean

Returns:

true if this resource represents a directory
isDirectory
()

public List<Resource>

Returns:

a list of resources in this directory
list
()

public void
serve(final Sender
The sender to use.
sender
,
final HttpServerExchange
The exchange
exchange
,
final IoCallback completionCallback)

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

Method Detail

getCacheKeyback to summary
public String getCacheKey()
Returns:String

A string that uniquely identifies this resource

getContentLengthback to summary
public Long getContentLength()
Returns:Long

The content length, or null if it is unknown

getContentTypeback to summary
public String getContentType(final MimeMappings mimeMappings)

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.

getETagback to summary
public ETag getETag()
Returns:ETag

The resources etags

getFileback to summary
public File getFile()
Returns:File

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

getFilePathback to summary
public Path getFilePath()
Returns:Path

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

getLastModifiedback to summary
public Date getLastModified()
Returns:Date

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

getLastModifiedStringback to summary
public String getLastModifiedString()
Returns:String

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

getNameback to summary
public String getName()
Returns:String

The name of the resource

getPathback to summary
public String getPath()
Returns:String

The path from the resource manager root

getResourceManagerRootback to summary
public File 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

getResourceManagerRootPathback to summary
public Path 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

getUrlback to summary
public URL getUrl()
Returns:URL

The URL of the resource

isDirectoryback to summary
public boolean isDirectory()
Returns:boolean

true if this resource represents a directory

listback to summary
public List<Resource> list()
Returns:List<Resource>

a list of resources in this directory

serveback to summary
public void serve(final Sender sender, final HttpServerExchange exchange, final IoCallback completionCallback)

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

Parameters
sender:Sender

The sender to use.

exchange:HttpServerExchange

The exchange