Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Class: RT.Servers.FileSystemHandler

Summary

Provides a handler for HttpServer that can return files and list the contents of directories on the local file system.

Remarks

The behavior of FileSystemHandler can be configured by placing a file called folder_config.json in a folder. The following options are supported:

  • redirect_to (string)
    If the user accesses the folder itself directly, HttpServer will redirect the user to the specified sub-URL. This effectively prevents the user from seeing a directory listing even if this would otherwise be allowed. The value must be a non-empty string, not begin with / and not contain a .. path segment.
  • wildcards (bool)
    Specifies whether the user may access files using wildcards (for example, /foo*.txt will access the first file in the folder that matches this pattern). If not specified, the default is false if FileSystemOptions.DirectoryListingStyle is DirectoryListingStyle.Forbidden and true otherwise. Applies recursively to subfolders.
  • 404 (string or object: { "file": string, "type": string })
    Specifies a file (must be in the same folder) that is returned with 404 errors (when the user requests a URL that isn’t a file or directory). The type option specifies the MIME type for the file. Applies recursively to subfolders.

Constructors

FileSystemHandler(string baseDir, FileSystemOptions options = null)
Initializes a new instance of FileSystemHandler.

Instance methods

HttpResponse Returns an HttpResponse that handles the specified request, either by delivering a file from the local file system, or by listing the contents of a directory in the local file system. The file or directory served is determined from the configured FileSystemHandler.BaseDirectory and the HttpRequest.Url of the specified request.

Instance properties

string Specifies the directory in the local file system from which files are served and directory contents are listed.
FileSystemOptionsSpecifies the options associated with this instance, or null to use the FileSystemHandler.DefaultOptions.

Static properties

FileSystemOptions Specifies the default options to fall back to whenever an instance of this class has no options of its own.