Instead of serving files from a special directory verbatim, the Web server executes the contained Scheme code and serves the output. By default, the special directory is named "servlets" within the "default-web-root" of the "web-server" collection directory. Each file in that directory must evaluate to a servlet.
A servlet is a module
that provides
three values: an
interface-version
,
a timeout
, and a
start
procedure:
(module servlet mzscheme
(require (lib "servlet.ss" "web-server"))
(provide interface-version timeout start)
(define interface-version 'v1)
(define timeout +inf.0)
(define (start initial-request)
...))
The start
procedure should produce a
response to an HTTP request. Please
refer to the documentation available via the Help
Desk for more information about working with these
values and programming servlets.
The Web server caches passwords and servlets for performance reasons. Requesting the URL
http://my-host/conf/refresh-passwords
reloads the password file. After updating a servlet, loading the URL
http://my-host/conf/refresh-servlets
causes the server to reload each servlet on the next invocation. This loses any per-servlet state (not per servlet instance state) computed before the unit invocation.
The Web server's garbage collect may be invoked at the URL:
http://my-host/conf/collect-garbage