On Mon, Sep 22, 2008 at 22:33, Bryan Emrys bryan.emrys@gmail.com wrote:
Newbie question. Can anyone explain why people would want to override the standard dispatcher? E.g. in http://www.lispcast.com/files/episode3/reddit-lisp.lisp
(defclass handler () ((url :initarg :url :accessor url :type string) (handler :initarg :handler :accessor handler) (name :initarg :name :accessor name
:type symbol)))
(defvar *handlers* (make-hash-table))
(defun our-handler (request) (let ((handler (gethandler (hunchentoot:script-name request)))) (when handler (handler handler))))
(setf hunchentoot:*dispatch-table* (list 'our-handler))
I personally find Hunchentoot's default handler architecture hard to work with. To me, a simple mapper from a URL prefix to a handler function is much easier to understand. That is why I have a request dispatch mechanism similar to the one you've reproduced in my web framework.
-Hans