[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

<http://pre.plt-scheme.org/docs/html/web-server/web-server-Z-H-12.html#node_sec_10.1.3>

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)
       (list
        "text/html"
        "<html><head></head><body>Foo</body><html>")))

I get the following error in the browser:

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

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

<h2>The Full Xexpr Is</h2>

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

Am I misinterpreting the documentation?

-- 
Jens Axel Søgaard



Posted on the users mailing list.