[hunchentoot-devel] Customizing acceptor behaviour

R.Stoye stoye at stoye.com
Thu Oct 15 12:30:05 UTC 2009


Another approach is to add an dispachtable slot to an customized  
acceptor class (as it was before Hunchentoot version 1.0):

(in-package :hunchentoot)

(defun pre1-list-request-dispatcher (request)
   (loop for dispatcher in (acceptor-dispatch-table *acceptor*)
         for action = (funcall dispatcher request)
         when action return (funcall action)
         finally (setf (return-code *reply*) +http-not-found+)))


(defclass pre1-acceptor (acceptor)
   ((pre1-dispatch-table :initarg :dispatch-table
			:accessor acceptor-dispatch-table))
   (:default-initargs
    :request-dispatcher #'pre1-list-request-dispatcher
     :dispatch-table nil))

;; (setf *myserver1* (make-instance 'pre1-acceptor :port 42001))
;; (setf (acceptor-dispatch-table *myserver1*)  (list (create-prefix- 
dispatcher "/mypage1.html" #'mypage1)))





More information about the Tbnl-devel mailing list