type

WispService

src const class WispService : Obj, Service

Simple web server services HTTP/HTTPS requests to a top-level root WebMod. A given instance of WispService can be only be used through one start/stop lifecycle.

Example:

WispService { httpPort = 8080; root = MyWebMod() }.start

constructors

make

Constructor with it-block

fields

addr

Which IpAddr to bind to or null for the default.

errMod

WebMod which is called on internal server error to return an 500 error response.

extraResHeaders

Map of HTTP headers to include in every response.

httpPort

Well known TCP port for HTTP traffic.

httpsPort

Well known TCP port for HTTPS traffic.

maxThreads

Max number of threads which are used for concurrent web request processing.

root

Root WebMod used to service requests.

sessionCookieName

Cookie name to use for built-in session management.

sessionStore

Pluggable interface for managing web session state.

socketConfig

The SocketConfig to use for creating sockets

methods

Slot Details

addr

src const IpAddr? addr := null

Which IpAddr to bind to or null for the default.

errMod

src const WebMod errMod := initErrMod

WebMod which is called on internal server error to return an 500 error response. The exception raised is available in req.stash["err"]. The onService method is called after clearing all headers and setting the response code to 500. The default error mod may be configured via errMod property in etc/web/config.props.

extraResHeaders

src const Str:Str extraResHeaders := initExtraResHeaders

Map of HTTP headers to include in every response. These are initialized from etc/web/config.props with the key "extraResHeaders" as a set of "key:value" pairs separated by semicolons.

httpPort

src const Int? httpPort := null

Well known TCP port for HTTP traffic. The port is enabled if non-null and disabled if null.

httpsPort

src const Int? httpsPort := null

Well known TCP port for HTTPS traffic. The port is enabled if non-null and disabled if null. If the http and https ports are both non-null then all http traffic will be redirected to the https port.

make

src new make(|This|? f := null)

Constructor with it-block

maxThreads

src const Int maxThreads := 500

Max number of threads which are used for concurrent web request processing.

onStart

src virtual override Void onStart()

onStop

src virtual override Void onStop()

root

src const WebMod root := WispDefaultRootMod.<ctor>()

Root WebMod used to service requests.

sessionCookieName

src const Str sessionCookieName := ...

Cookie name to use for built-in session management. Initialized from etc/web/config.props with the key "sessionCookieName" otherwise defaults to "fanws"

sessionStore

src const WispSessionStore sessionStore := MemWispSessionStore.<ctor>(this)

Pluggable interface for managing web session state. Default implementation stores sessions in main memory.

socketConfig

src const SocketConfig socketConfig := SocketConfig.cur

The SocketConfig to use for creating sockets