[racket] stateless servlets problem

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sun Jan 2 09:45:53 EST 2011

The make*servlet functions are internal APIs of the Web Server that
create data structures to represent servlets. You don't want to use
those. You want to use #lang racket (for stateful) or #lang web-server
(for stateless) and using serve/servlet [or create a module servlet]

Jay

2011/1/2 Stefan Schmiedl <s at xss.de>:
> Greetings.
>
> I can't create a stateless servlet in racket 5.0.2 (gentoo amd64).
>
> I _can_ create a stateful servlet with
>
>  (define (default-lru-manager)
>    (make-threshold-LRU-manager
>                      (lambda (request)
>                        `(html (head (title "Page Has Expired."))
>                               (body (p "Sorry, this page has expired. Please go back."))))
>                      (* 16 1024 1024)))
>
>  (define hello-servlet
>    (make-v2.servlet (current-directory)
>                     (default-lru-manager)
>                     hello-servlet-start))
>
>
> If I understand the docs correctly, the following code should then create
> a stateless servlet
>
>  (define world-servlet
>    (make-stateless.servlet (current-directory)
>                            default-stuffer
>                            (default-lru-manager)
>                            world-servlet-start))
>
> as (default-lru-manager) was fulfilling the contract requirements in the
> stateful case.
>
> But when I run the buffer (Ctrl-T), I get the following error message:
>
>  <collects>/web-server/managers/manager.rkt:5.15:
>    (file
>     /usr/lib64/racket/collects/web-server/servlet/setup.rkt)
>   broke the contract
>    (-> manager? (-> (-> void) number?))
>   on manager-create-instance; expected a procedure that accepts no mandatory arguments without any keywords, given: #<procedure:drscheme-exit-handler>
>
> I also tried substituting the LRU-manager with (create-none-manager #f),
> but this did not change the error message. I don't quite get where the
> #<procedure:drscheme-exit-handler> comes from at all.
>
> What am I doing wrong here?
>
> Thanks,
> s.
> _________________________________________________
>  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.