[racket] Do stateless servlets need continuation managers?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Mar 10 22:59:10 EST 2011

2011/3/10 Doug Orleans <dougorleans at gmail.com>:
> When I try to run this simple servlet:
>
> #lang web-server
>
> (require web-server/servlet)

This line requires the STATEFUL send/suspend/dispatch, replace it with

(require web-server/http/xexpr)

to get response/xexpr and it should do what you think.

Stateless servlets can use managers for two-state continuations though.

Jay

> (provide interface-version start)
> (define interface-version 'stateless)
>
> (define (start request)
>   (send/suspend/dispatch
>    (lambda (k-url)
>      (response/xexpr
>       `(html (body (a ((href ,(k-url start))) "Hello!")))))))
>
> I get this (very unhelpful) error in the browser:
>
> Exception
>
> The application raised an exception with the message:
>
> No instance for id: 0
>
> Stack trace:
>
> continuation-store! at:
>   line 31, column 2, in file
> /usr/racket/collects/web-server/managers/none.rkt
> <unknown procedure> at:
>   line 88, column 5, in file /usr/racket/collects/web-server/servlet/web.rkt
>
>
> <unknown procedure> at:
>   line 129, column 19, in file
> /usr/racket/collects/web-server/servlet/web.rkt
> <unknown procedure> at:
>   line 122, column 10, in file
> /usr/racket/collects/web-server/servlet/web.rkt
>
>
> send/suspend/dispatch at:
>   line 116, column 0, in file
> /usr/racket/collects/web-server/servlet/web.rkt
> <unknown procedure> at:
>   line 58, column 2, in file
> /usr/racket/collects/web-server/dispatchers/dispatch-servlets.rkt
>
>
> select-handler/no-breaks at:
>   line 164, column 2, in file
> /usr/racket/collects/racket/private/more-scheme.rkt
> select-handler/no-breaks at:
>   line 164, column 2, in file
> /usr/racket/collects/racket/private/more-scheme.rkt
>
>
> select-handler/no-breaks at:
>   line 164, column 2, in file
> /usr/racket/collects/racket/private/more-scheme.rkt
> select-handler/no-breaks at:
>   line 164, column 2, in file
> /usr/racket/collects/racket/private/more-scheme.rkt
>
>
> select-handler/no-breaks at:
>   line 164, column 2, in file
> /usr/racket/collects/racket/private/more-scheme.rkt
> select-handler/no-breaks at:
>   line 164, column 2, in file
> /usr/racket/collects/racket/private/more-scheme.rkt
>
>
> connection-loop at:
>   line 74, column 2, in file
> /usr/racket/collects/web-server/private/dispatch-server-unit.rkt
>
> Do I need to define a continuation manager?  I thought that stateless
> servlets didn't need them, since continuations were "managed" by the
> client.  Or maybe I don't understand what "stateless" means here?
>
> --dougorleans at gmail.com
>
>
> _________________________________________________
>  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.