The following servlet show an input field from a formlet and then tries to use 
formlet-process on the resulting request. I don't understand why this fails 
when, like below, the send/suspend and formlet-process is in a function but 
works when inlined, like the #; commented code in handle-html-form.

The error is

stuff-url: Cannot stuff (kont #<procedure:...abort-resume.rkt:154:25>) into a 
URL because it contains non-serializable pieces. Convert 
#<procedure:...formlets/lib.rkt:17:2> to a serializable struct

Why does the extra lambda lead to this error message?


#lang web-server
(provide handle-html-form
     interface-version)
(define interface-version 'stateless)
(require web-server/formlets web-server/servlet-env)

(define main-input-formlet
(formlet
(#%# ,[(to-string (required (text-input))) . => . text])
text))

(define (send/form2 f)
(formlet-process f
               (send/suspend
                (lambda (k-url)
                  (response/xexpr
                   `(form ([action ,k-url] [method "POST"])
                          ,@(formlet-display f)))))))

(define (handle-html-form req)
(define user-input
(send/form2 main-input-formlet)
#;(formlet-process
 main-input-formlet
 (send/suspend
  (lambda (k-url)
    (response/xexpr
     `(form ([action ,k-url] [method "POST"])
            ,@(formlet-display main-input-formlet)))))))
(displayln user-input))

(serve/servlet handle-html-form #:stateless? #t)
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to