[racket] stateless servlets problem

From: Stefan Schmiedl (s at xss.de)
Date: Sun Jan 2 15:07:38 EST 2011

On Sun, 2 Jan 2011 19:23:42 +0100
Stefan Schmiedl <s at xss.de> wrote:

For now I'm content with having a web server that can serve
> static files, call functions to handle requests or dispatch to different
> (kinds of) servlets. Not sure that having such a beast run in the wild
> is such a great idea, though.
> 

FWIW, would this solution be the "correct" way to implement this kind of thing?
For suitable definitions of hello et al., of course.

  (require (prefix-in ds: web-server/dispatchers/dispatch-sequencer)
           (prefix-in df: web-server/dispatchers/dispatch-filter)
           (prefix-in dl: web-server/dispatchers/dispatch-lift))

  (define dispatch (ds:make 
                    (df:make #rx"^/a.rkt" (dl:make hello))
                    (df:make #rx"^/servlets" (ds:make 
                                              (dispatch/servlet hello-servlet-start #:regexp #rx"a.rkt" #:stateless? #t)
                                              (dispatch/servlet world-servlet-start #:regexp #rx"b.rkt" #:stateless? #f)))))

Way more elegant than what I had before, and works without
raising exceptions.

Thanks,
s.


Posted on the users mailing list.