[plt-scheme] Module servlets and non-sexpr responses

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sun Nov 19 12:22:12 EST 2006

According to


a legal response from a servlets is

   (listof (union string bytes))
       The first string is the MIME type (often "text/html", but see RFC
    2822 for other options). The rest of the strings provide the
    document's content.

but nevertheless, I can't get this simple example to run:

(module static mzscheme
   (require (lib "servlet.ss" "web-server"))
   (provide interface-version timeout start)
   (define interface-version 'v1)
   (define timeout +inf.0)
   (define (start initial-request)
      (report-errors-to-browser send/finish)

I get the following error in the browser:

   <head><title>Erroneous Xexpr</title></head>
   <body><h1>Erroneous Xexpr</h1>
   <p>An Xexpr in the servlet is malformed. The exact error

<pre>Expected a symbol as the element name, given

<h2>The Full Xexpr Is</h2>

<pre><font color="red">
   ("text/html" "<html><head></head><body>Foo</body></html>")

Am I misinterpreting the documentation?

Jens Axel Søgaard

Posted on the users mailing list.