On Fri, 6 Jul 2007 18:40:56 +0100 Alaric Snell-Pym <[EMAIL PROTECTED]> wrote:
> Why's http:find-resource need hacking? Because http:find-resource searches for resources using something like equal?. url-dispatcher needs some resource finder which looks for resources from a given pathname -- like regex matching. For example, with the stock http:find-resource, and using (register-dispatcher "/procs") , an access to http://web.server/procs/add/1/2 would produce a 404 error (assuming /procs is empty). The hacked http:find-resource looks for resources using regular expressions. So, what register-dispatcher does behind the scenes is something like (http:add-resource "/procs/.*" (lambda ...)) This way, the http-server can find whatever resource which matches ".*" under /procs (/procs is used as an environment). So we can have the evaluation of (add "1" "2") in the `procs' environment. This environment thing is particularly interesting because you can have, say, (register-dispatcher "/procs") (register-dispatcher "/other-procs") and each one have its own definition of `add', once you declare them like: (define-callable-url 'procs (add . args) ...) (define-callable-url 'other-procs (add . args) ...) But if you want `add' to be defined as a "toplevel" procedure, just ommit the environment: (define-callable-url (add . args) ...) Best wishes, Mario _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
