-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebsite.lisp
More file actions
34 lines (23 loc) · 1.03 KB
/
website.lisp
File metadata and controls
34 lines (23 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;; (c) www.neverblued.info
;; LLGPL -> http://opensource.franz.com/preamble.html
(in-package #:wsf)
(defclass website (docroot-server parse-server router http-server) ())
(defparameter server-charset :utf-8)
;(defmacro catch-server-conditions (&body body)
; `(handler-case (progn ,@body)
; (hunchentoot-simple-warning ()
; (print "it's a hunchentoot warning!"))))
(defmethod respond :around ((server website) request)
(let ((*hunchentoot-default-external-format* (charset-instance server-charset)))
;(catch-server-conditions
(call-next-method)))
(defparameter error-pages-folder-pathname "view/page/error")
(defmethod initialize-instance :after ((server website) &key)
(setf (acceptor-error-template-directory (server-acceptor server))
(from-docroot server error-pages-folder-pathname "/")))
(defmacro defsite (name (&rest superclasses) &rest args)
`(progn
(defclass ,name (,@superclasses wsf:website) ())
(defvar ,name
(make-instance ',name ,@args))
(setf *server* (symbol-value ',name))))