Hi Alaric and folks, On Fri, 6 Jul 2007 01:23:00 +0100 Alaric Snell-Pym <[EMAIL PROTECTED]> wrote:
> An arguments declaration might look like this: > > (positional > ((user-id integer)) > named > ((comment-id "c" optional integer) > (search-terms "s" optional string)) > data-sources > ((user userdb (user-id)) > (comment comments optional (comment-id)))) > > What this means is: > > * If there is a path component AFTER the script name - eg, "1" in > http://www.example.com/test.ws/1 - then it's passed through string- > >integer and bound to "user-id". If it's not present, we generate a > 404 Not Found. If it's present but not a valid integer, then the page > just returns with a 404 Not Found. > > * If there is a GET variable called "c" then it's likewise processed > as an integer and bound to comment-id. Otherwise, comment-id is bound > to nil. If I understand correctly, this is somewhat similar to a sort of url dispatcher once I implemented (without type declarations) but never bothered to use: http://schemers.ucpel.tche.br/mario/url-dispatcher.html (code at http://schemers.ucpel.tche.br/mario/url-dispatcher.scm). It supports environments (something like namespaces for URLs mapped to Scheme procedures), has some syntax for defining URL mappings and handles GET and POST variables. A hacked http:find-resource is required (not a good approach -- it would be better implemented using a special fallback-handler). Hope it makes sense. Best wishes, Mario _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
