Class: WebSession

server.WebSession

Class representing a plain web session serving a filesystem for GET and HEAD methods.

When requesting a folder, a simple HTML page with the folder's contents is generated.

Example

HTTPServer {

    host: "0.0.0.0"
    port: 8000

    LocalFS {
        id: localFs
    }

    HTTPRoute {

        delegate: WebSession {
            filesystem: localFs
            root: "/opt/www"
            indexFile: "index.html"
        }

    }

}

new server.WebSession ()

Properties:
Name Type Description
indexFile string

(default: "") If set, a redirect is made to this file (e.g. "index.html") when attempting to open a directory.

filesystem core.Filesystem

(default: null) The filesystem to serve.

root string

(default: "/") The local path to use as the root folder.

Extends