[racket] Stateless servlets and formlets error

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Feb 7 17:24:46 EST 2013

On Wed, Feb 6, 2013 at 9:00 AM, Lorenz Köhl <rainbowtwigs at gmail.com> wrote:
>>> Why does the extra lambda lead to this error message?
>>
>> The answer to the "WHY" is this:
>>
>> 2. If you inline it, or replace the f is send/form2 with
>> 'main-input-formlet', then you are now referring to a global variable,
>> which is never part of closures, because it is always available.
>
> I see, this is what confused me. Thanks for the explanation.
>
>> I don't think the benefits are worth it to justify things in the case
>> of formlets, but I'm open to arguments.
>
> I'll make the formlets toplevel.
>
> The other problem I have is calling functions from the servlet that use send/suspend and friends, which expect certain continuation marks as I understand it. Is it possible to fake these for a unit test?

Yes... you would want to use call-with-web-prompt from

https://github.com/plt/racket/blob/master/collects/web-server/lang/abort-resume.rkt

And it should "just work"

> Another way is to modify make-servlet-tester to not redact the response so I can test other properties like return code and headers. But I'd prefer to do it directly.

I think this would be better to do. We just need to change line 24

https://github.com/plt/racket/blob/master/collects/web-server/test.rkt#L24

to support the stateless mode.

And lines 53-57 to allow you to see the currently un-named part of the
bytes (the .+ in the regexp.)

Jay


--
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.