Thanks Jay.<div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div><br><br><div class="gmail_quote">On Sun, May 8, 2011 at 6:57 AM, Jay McCarthy <span dir="ltr"><<a href="mailto:jay.mccarthy@gmail.com">jay.mccarthy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Stateless servlets must be written in the #lang web-server language.<br>
<br>
Once you write them that way, if you want to start a server that<br>
launches them, you need to use #:stateless?<br>
<br>
Unless you have both pieces, it won't work.<br>
<br>
Jay<br>
<br>
2011/5/7 Rahul Kumar <<a href="mailto:rahulsinner@gmail.com">rahulsinner@gmail.com</a>>:<br>
<div><div></div><div class="h5">> Hi,<br>
> What do I need to do to run a stateless servlet?<br>
> Consider the following example taken from the web tutorial. I just added<br>
> `#:stateless? #t` while starting.<br>
> #lang racket<br>
> (require web-server/servlet<br>
> web-server/servlet-env)<br>
> ; start: request -> response<br>
> (define (start request)<br>
> (show-counter 0 request))<br>
> ; show-counter: number request -> doesn't<br>
> ; Displays a number that's hyperlinked: when the link is pressed,<br>
> ; returns a new page with the incremented number.<br>
> (define (show-counter n request)<br>
> (send/suspend/dispatch<br>
> (lambda (url)<br>
> (response/xexpr<br>
> `(html (head (title "Counting example"))<br>
> (body<br>
> (a<br>
> ([href ,(url<br>
> (lambda (req)<br>
> (show-counter (add1 n) req)))])<br>
> ,(number->string n))))))))<br>
> (serve/servlet start<br>
> #:port 7070<br>
> #:servlet-path "/"<br>
> #:listen-ip #f<br>
> #:stateless? #t)<br>
><br>
> This doesn't work. I am looking at the web server reference but I can't find<br>
> a proper example.<br>
><br>
><br>
</div></div>> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Jay McCarthy <<a href="mailto:jay@cs.byu.edu">jay@cs.byu.edu</a>><br>
Assistant Professor / Brigham Young University<br>
<a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>
"The glory of God is Intelligence" - D&C 93<br>
</font></blockquote></div><br></div>