CachingVirtualDirectory class

A VirtualDirectory that also sets Cache-Control headers.

Inheritance

Constructors

CachingVirtualDirectory(Angel app, FileSystem fileSystem, {CacheAccessLevel accessLevel = CacheAccessLevel.public, Directory? source, bool debug = false, Iterable<String> indexFileNames = const ['index.html'], int maxAge = 0, bool noCache = false, bool onlyInProduction = false, bool useEtags = true, bool allowDirectoryListing = false, bool useBuffer = false, String publicPath = '/', dynamic callback(File file, RequestContext req, ResponseContext res)?})

Properties

accessLevel CacheAccessLevel
Either public or private.
final
allowDirectoryListing bool
If true (default: false), then if a directory does not contain any of the specific indexFileNames, a default directory listing will be served.
finalinherited
app → Angel
finalinherited
callback → (dynamic Function(File file, RequestContext req, ResponseContext res)?)
An optional callback to run before serving files.
finalinherited
fileSystem → FileSystem
finalinherited
hashCode int
The hash code for this object.
no setterinherited
indexFileNames Iterable<String>
Filenames to be resolved within directories as indices.
finalinherited
maxAge int
The max-age for Cache-Control.
final
noCache bool
If true, responses will always have private, max-age=0 as their Cache-Control header.
final
onlyInProduction bool
If true (default), Cache-Control headers will only be set if the application is in production mode.
final
publicPath String
An optional public path to map requests to.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source → Directory
The directory to serve files from.
no setterinherited
useBuffer bool
If true (default: true), then files will be opened as streams and piped into the request.
finalinherited
useEtags bool
If true (default), ETags will be computed and sent along with responses.
final

Methods

handleRequest(RequestContext req, ResponseContext res) Future<bool>
Responds to incoming HTTP requests.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushState(String path, {Iterable? accepts}) → RequestHandler
A handler that serves the file at the given path, unless the user has requested that path.
inherited
serveDirectory(Directory directory, String relative, FileStat stat, RequestContext req, ResponseContext res) Future<bool>
Serves the index file of a directory, if it exists.
inherited
serveFile(File file, FileStat stat, RequestContext req, ResponseContext res) Future<bool>
Writes the contents of a file to a response.
override
servePath(String path, RequestContext req, ResponseContext res) Future<bool>
Writes the file at the given virtual path to a response.
inherited
serveStat(String absolute, String relative, FileStat stat, RequestContext req, ResponseContext res) Future<bool>
Writes the file at the path given by the stat to a response.
inherited
setCachedHeaders(DateTime modified, RequestContext req, ResponseContext res) → void
toString() String
A string representation of this object.
inherited

Operators

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