chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] dynamic web resources?


From: Andreas Zwinkau
Subject: Re: [Chicken-users] dynamic web resources?
Date: Tue, 17 Oct 2006 08:58:00 +0200

> In the file attached to the message pointed by the link above, you can
> find the code to map a part of an URL to a Scheme procedure name.  To
> achieve that, the http-server's `http:find-resource' procedure needs
> to be modified to match regexes.  As far as I understand, it's similar
> to what you suggest as `http:add-dynamic-resource'.
Yes, it's similar, but not exactly the same thing. How does your
interface react on too much or few variables?

I wrote some dispatch code, which passes this test (using check egg):

(letrec ((something 'blub)
         (dispatch (dispatch-rules
                    (("/" "/index") ((GET something) (POST 'error)))
                    ("/:pagename"   ((GET 'show-page))))))
  (check (dispatch "/" 'GET) => something)
  (check (dispatch "/index" 'POST) => 'error)
  (check (dispatch "/hi" 'GET) => 'show-page))

This is only the lookup. "something" could be a function and called
with the request object and the "pagename" variable. This interface is
more strict than Marios.

The fallback-handler seems to be the way to use this.
-- 
Gottes Segen!
Andi


  | Mail: address@hidden 
  | Web: http://beza1e1.tuxen.de
  | Jabber: address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]