Thanks Jay. Worked like a charm. For anyone else fighting with the same issue, the only change needed is the `#lang web-server` in-place of `#lang racket` in the code sample - `#:stateless? #t` is already there.
Out of curiosity, since I didn't need to make any code changes to make stateless work, is there any reason to run stateful servlets? The only concern I see is the default stuffer which does disk writes - that too if the urls are large. Nothing a fast disk and short ulrs can't mitigate. On Sun, May 8, 2011 at 6:57 AM, Jay McCarthy <jay.mccar...@gmail.com> wrote: > 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 <rahulsin...@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 <j...@cs.byu.edu> > Assistant Professor / Brigham Young University > http://faculty.cs.byu.edu/~jay > > "The glory of God is Intelligence" - D&C 93 >
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users