[racket] stateless servlets problem

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Jan 3 09:04:23 EST 2011

I've dug into this deeper and it turns out that it is an error in the
Web Server. The code that sets up servlets abuses the fact that the
servlet dispatcher sets the exit-handler in a particular way (that is
actually a violation of its unchecked contract.)

I've made a fix and will push it shortly.

Thanks for finding the problem,


2011/1/2 Stefan Schmiedl <s at xss.de>:
> 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).
> s.

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.