I see now, thanks a lot. Andrew
On Tue, Jul 24, 2012 at 2:00 PM, Sebastian Tennant sebyte@smolny.plus.com wrote:
Quoth Andrei Stebakov lispercat@gmail.com:
As I understand the whole acceptor-status-message has to be overloaded?
(use-package :hunchentoot)
First you have to subclass acceptor. For example:
(defclass custom-acceptor (acceptor) nil)
Now you can specialise acceptor-status-message on custom-acceptor like so:
(defmethod acceptor-status-message ((acceptor custom-acceptor) http-status-code &rest args &key &allow-other-keys) (when (equal http-status-code +http-internal-server-error+) (apply custom-error-page args)) (call-next-method))
Finally define custom-error-page:
(defun custom-error-page (k1 error k2 backtrace) (format nil "<html> <head></head> <body> <h2>whoops!</h2> <p>Error: ~a</p> ~a </body> </html>" error backtrace))
Don't forget to start your custom-acceptor like so:
(tbnl:start (make-instance 'custom-acceptor ...))
Hope this helps. None of this code is tested by the way.
Seb
Emacs' AlsaPlayer - Music Without Jolts Lightweight, full-featured and mindful of your idyllic happiness. http://home.gna.org/eap
tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel