(module servlet mzscheme
(provide servlet)
(require (lib "servlet.ss" "web-server")
(lib "xml.ss" "xml")
"cookie.scm"
"binding.scm"
"response.scm"
"request.scm"
"default.scm")
(define-syntax servlet
(syntax-rules ()
[(servlet body ...)
(lambda (initial-request)
(with-defaults
(parameterize ([current-request initial-request]
[current-cookies (request-cookies initial-request)]
[current-output-cookies '()]
[current-bindings (request-bindings initial-request)])
(let ([document
(xexpr->string
(begin body ...))])
(make-response document)))))]))
)