[Bese-devel] REGEXP-DISPATCHER not binding the registers
Daniel Janus
daniel at sentivision.com
Wed Feb 7 10:28:16 UTC 2007
Hello,
Here is an excerpt from the documentation of REGEXP-DISPATCHER macro:
Any registers in URL-REGEXP are available through the array bound
to *dispatcher-registers*.
Unfortunately, it doesn't do that; the registers are lost on the way from
regexp-url-matcher to the dispatcher handler.
I worked around this by specializing my own handler on ENTRY-POINT-HANDLER
like this:
(defclass regexp-binding-handler (ucw::entry-point-handler)
())
(defmethod ucw::handler-handle ((handler regexp-binding-handler)
(application standard-application)
(context ucw::standard-request-context)
matcher-result)
(let ((*dispatcher-registers* (cadr matcher-result)))
(call-next-method)))
(defclass regexp-binding-dispatcher
(ucw::abstract-dispatcher ucw::regexp-url-matcher
regexp-binding-handler)
())
(defmacro regexp-binding-dispatcher (url-regexp &body body)
"Unlike UCW's REGEXP-DISPATCHER, this dispatcher _really_ binds
the registers in URL-REGEXP to *dispatcher-registers*."
`(make-instance 'regexp-binding-dispatcher
:url-string ,url-regexp
:handler (lambda ()
(with-call/cc
(let ((self nil))
, at body)))))
However, I feel that REGEXP-DISPATCHER should be specialized on
REGEXP-BINDING-HANDLER. Could anyone check it and accordingly
merge with mainline?
Thanks,
--
(with-best-regards '(Daniel Janus)
:of 'Sentivision)
More information about the bese-devel
mailing list