[plt-scheme] Web Server documentation reorganization

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Apr 2 11:35:07 EDT 2009

I've changed this to the following:

Suppose you would like to start a server for a stateless Web servlet
"servlet.ss" that provides start:

  #lang scheme
  (require "servlet.ss"

  (serve/servlet start #:stateless? #t)

Warning: If you put the call to serve/servlet in a web-server module
directly it will not work correctly. Consider the following module:

  #lang web-server
  (require web-server/servlet-env)

  (define (start req)
      (lambda (k-url)
        `(html (body (a ([href ,k-url]) "Hello world!")))))))

  (serve/servlet start #:stateless? #t)

First, if this module is not saved in a file (e.g., "servlet.ss"),
then the serialization layer cannot locate the definitions of the
serialized continuations. Second, due to an unfortunately subtle bug
that we have not yet corrected, every time the continuation link is
clicked, serve/servlet will run and attempt to start a Web server
instance and open a browser window. These problems do not occur if
your servlet is saved in a file and if serve/servlet is run in another

On Thu, Apr 2, 2009 at 8:33 AM, Eric Hanchrow <eric.hanchrow at gmail.com> wrote:
> On Mon, Mar 30, 2009 at 10:13 AM, Jay McCarthy <jay.mccarthy at gmail.com>
> wrote:
>> Hello all,
>> I've been working on reorganizing the Web server documentation into
>> two manuals: one for writing Web applications and another about the
>> Web server itself. I've finished a first cut and I'd like to get a few
>> comments before I commit.
> Can you clarify  what "like normal" means in
> If you put the call to serve/servlet in the module like normal, strange
> things will happen because of the way the top-level interacts with
> continuations. (Read: Don’t do it.)
> ?  And for that matter,can you give a hint of what strange things will
> happen?

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.