- Index
- »
- wisp
- »
- WispService
type
WispService
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 |
methods
Slot Details
addr
const IpAddr? addr := null
Which IpAddr to bind to or null for the default.
errMod
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
httpPort
const Int? httpPort := null
Well known TCP port for HTTP traffic. The port is enabled if non-null and disabled if null.
httpsPort
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
new make(|This|? f := null)
Constructor with it-block
maxThreads
const Int maxThreads := 500
Max number of threads which are used for concurrent web request processing.
onStart
virtual override Void onStart()
onStop
virtual override Void onStop()
root
const WebMod root := WispDefaultRootMod.<ctor>()
Root WebMod used to service requests.
sessionCookieName
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
const WispSessionStore sessionStore := MemWispSessionStore.<ctor>(this)
Pluggable interface for managing web session state. Default implementation stores sessions in main memory.
socketConfig
const SocketConfig socketConfig := SocketConfig.cur
The SocketConfig
to use for creating sockets