[racket] Can't find how to use stateless servlets.

From: Rahul Kumar (rahulsinner at gmail.com)
Date: Sat May 7 21:00:31 EDT 2011


What do I need to do to run a stateless servlet?

Consider the following example taken from the web tutorial. I just added
`#:stateless? #t` while starting.

#lang racket
(require web-server/servlet

; start: request -> response
(define (start request)
  (show-counter 0 request))

; show-counter: number request -> doesn't
; Displays a number that's hyperlinked: when the link is pressed,
; returns a new page with the incremented number.
(define (show-counter n request)
    (lambda (url)
        `(html (head (title "Counting example"))
                   ([href ,(url
                             (lambda (req)
                               (show-counter (add1 n) req)))])
                   ,(number->string n))))))))

(serve/servlet start
                #:port 7070
                #:servlet-path "/"
                #:listen-ip #f
                #:stateless? #t)

This doesn't work. I am looking at the web server reference but I can't find
a proper example.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110508/0470d758/attachment.html>

Posted on the users mailing list.