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

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sat May 7 21:27:03 EDT 2011

Stateless servlets must be written in the #lang web-server language.

Once you write them that way, if you want to start a server that
launches them, you need to use #:stateless?

Unless you have both pieces, it won't work.

Jay

2011/5/7 Rahul Kumar <rahulsinner at gmail.com>:
> Hi,
> 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
>          web-server/servlet-env)
> ; 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)
>   (send/suspend/dispatch
>     (lambda (url)
>       (response/xexpr
>         `(html (head (title "Counting example"))
>                (body
>                  (a
>                    ([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.
>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

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



Posted on the users mailing list.