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, Iterable<String> indexFileNames, int maxAge: 0, bool noCache: false, bool onlyInProduction: false, bool useEtags: true, bool allowDirectoryListing, 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.
final, inherited
app Angel
final, inherited
callback → dynamic Function(File file, RequestContext req, ResponseContext res)
An optional callback to run before serving files.
final, inherited
fileSystem FileSystem
final, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
indexFileNames Iterable<String>
Filenames to be resolved within directories as indices.
final, inherited
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.
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
source Directory
The directory to serve files from.
read-only, inherited
useBuffer bool
If true (default: true), then files will be opened as streams and piped into the request. [...]
final, inherited
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 non-existent 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
Returns a string representation of this object.
inherited

Operators

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