FileResolvingHandler

Request handler that resolves files within a given base path. This handler will take the request URL, and try to find a file or directory matching that URL within its configured basePath. If a directory is requested, the handler will try to serve an "index" file from it, if such a file exists. If a file is requested, that file will be served, with the appropriate mime type, if it exists.

Note that only files strictly within the given basePath are able to be served; requests like /../../data.txt will result in a 404.

Constructors

this
this(string basePath, DirectoryResolutionStrategy directoryResolutionStrategy)

Constructs the request handler.

Members

Functions

handle
void handle(HttpRequestContext ctx)

Handles requests for files, where the url points to the file location relative to the base path.

registerMimeType
FileResolvingHandler registerMimeType(string fileExtension, string mimeType)

Registers a new mime type for this handler.

Inherited Members

From HttpRequestHandler

handle
void handle(HttpRequestContext ctx)

Handles an HTTP request. Note that this method may be called from multiple threads, as requests may be processed in parallel, so you should avoid performing actions which are not thread-safe.