VirtualDirectory class
A VirtualDirectory can serve files and directory-listing from a root path,
to HttpRequest
s.
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. Thecallback
will be called with theDirectory
to be listed and theHttpRequest
.write-only - errorPageHandler ← void Function(HttpRequest)
-
Set the
callback
to override the error page handler. Whencallback
is invoked, thestatusCode
property of the response is set.write-only - followLinks ↔ bool
-
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
ofHttpRequest
s, in this VirtualDirectory. -
serveFile(
File file, HttpRequest request) → void -
Serve the content of
file
torequest
. [...] -
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