[racket] stateless servlets problem

From: Stefan Schmiedl (s at xss.de)
Date: Sun Jan 2 10:30:09 EST 2011

On Sun, 2 Jan 2011 07:45:53 -0700
Jay McCarthy <jay.mccarthy at gmail.com> wrote:

> The make*servlet functions are internal APIs of the Web Server that
> create data structures to represent servlets. You don't want to use
> those. You want to use #lang racket (for stateful) or #lang web-server
> (for stateless) and using serve/servlet [or create a module servlet]

Hello Jay,

thank you for responding right now and about five years ago, when
you wrote "Automatically RESTful Web Applications", which gave me
the same idea right now :-)

I ran into this problem because I wanted to build a small file
showing how to use the different kinds of handling web requests
(files, function lifting, two kinds of servlets) on one page.

What is kind of puzzling to me, though, is that it looks like I'm
providing "good enough" arguments to fulfill the required contracts,
and it still does not work. I've probably not read enough of the manual
to really know what I'm doing.

I'm especially curious now, why racket complains about my code,
which is quite similar to what dispatch/servlet (web-server/servlet-dispatch.rkt)
is doing:

  (if stateless?
     (make-stateless.servlet servlet-current-directory stuffer manager start)
     (make-v2.servlet servlet-current-directory manager start))

Why can this library function get away with using the same manager
for both stateful and stateless servlets, and I can't?

Must be a case of "quod licet Iovi, non licet newbie" (argh).


Posted on the users mailing list.