VirtualDirectory class

A VirtualDirectory can serve files and directory-listing from a root path, to HttpRequests.

The VirtualDirectory providing secure handling of request uris and file-system links, correct mime-types and custom error pages.

Constructors

VirtualDirectory(String root, {String pathPrefix})

Properties

allowDirectoryListing bool
Set or get if the VirtualDirectory should list the content of directories.
read / write
directoryHandler void Function(Directory, HttpRequest)
Set the callback to override the default directory listing. The callback will be called with the Directory to be listed and the HttpRequest.
write-only
errorPageHandler void Function(HttpRequest)
Set the callback to override the error page handler. When callback is invoked, the statusCode property of the response is set.
write-only
Set or get if the VirtualDirectory should follow links, that point to other resources within the root directory.
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
jailRoot bool
Set or get if the VirtualDirectory should jail the root. When the root is not jailed, links can be followed to outside the root directory.
read / write
root String
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
serve(Stream<HttpRequest> requests) StreamSubscription<HttpRequest>
Serve a Stream of HttpRequests, in this VirtualDirectory.
serveFile(File file, HttpRequest request) → void
Serve the content of file to request. [...]
serveRequest(HttpRequest request) Future
Serve a single HttpRequest, in this VirtualDirectory.
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited