[racket-dev] form:binding / request utilities

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Mar 4 14:43:24 EST 2011

That sounds reasonable. Here are a few things:

1) I almost exclusively use formlets, where these issues are basically
taken care of. I suggest checking them out.

2) Would it be good for the request struct to be a prop:dict where the
dictionary is the bindings? Would that be confusing because it is also
plausible to "dictionary" on the headers?

3) Part of what you want is just request-bindings, but
request-bindings has lots of subtle bugs. For example, HTTP does not
mandate UTF-8, so naive conversion to Racket strings can crash. HTTP
differentiates between form bindings and file bindings---for files you
definitely want the bytes and you should also be able to get the
filename.

4) The docs are in web-server/scribblings/http.scrbl; The tests are in
tests/web-server/private/request-test.rkt and
tests/web-server/servlet/bindings-test.rkt

Jay

2011/3/4 John Clements <clements at brinckerhoff.org>:
> I'm doing a web-server/insta example in class, and one of my students (Arlo White, cc:'ed) pointed out that  the existing framework for extracting bindings seems to be missing a bunch of useful functions. In particular, he volunteered to implement a few of the functions from the Spring framework, most notably a function that accepts a request and a name and returns the string associated with that name in the request's bindings.  Like hash-ref, it would allow you to specify your own failure behavior.
>
> I've run into this myself, and it's always a pain to operate on the request structures.  Would you be open to adding a few functions like this to the web-server (if we provide them, along with docs and tests)? Looking at the documentation, it appears that there's some cleanup that just never made it to the top of someone's list.
>
> John
>
>



-- 
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 dev mailing list.