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})
Create a new VirtualDirectory for serving static file content of the path root.

Properties

allowDirectoryListing bool
Whether to allow listing files in a directories.
getter/setter pair
directoryHandler ← void Function(Directory, HttpRequest)
Overrides the default directory listing.
no getter
errorPageHandler ← void Function(HttpRequest)
Overrides the default error handle.
no getter
Whether to allow reading resources via a link.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
jailRoot bool
Whether to prevent access outside of root via relative paths or links.
getter/setter pair
root String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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
A string representation of this object.
inherited

Operators

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