write response directly in action handler => get rid of response:messages slot
This commit is contained in:
parent
84ce2c9e3a
commit
2d59317980
1 changed files with 3 additions and 6 deletions
|
@ -17,9 +17,9 @@
|
||||||
;;;; predefined action handlers / default actions
|
;;;; predefined action handlers / default actions
|
||||||
|
|
||||||
(defun render-msg (resp msg)
|
(defun render-msg (resp msg)
|
||||||
(if msg
|
|
||||||
(push msg (messages resp)))
|
|
||||||
(prepare resp)
|
(prepare resp)
|
||||||
|
(if msg
|
||||||
|
(funcall (writer resp) (render-content resp msg)))
|
||||||
(finish resp))
|
(finish resp))
|
||||||
|
|
||||||
(defun set-cookie (resp msg)
|
(defun set-cookie (resp msg)
|
||||||
|
@ -43,14 +43,13 @@
|
||||||
((context :reader context :initarg :context)
|
((context :reader context :initarg :context)
|
||||||
(core:actions :initform *default-actions*)
|
(core:actions :initform *default-actions*)
|
||||||
(env :reader env :initarg :env)
|
(env :reader env :initarg :env)
|
||||||
(messages :accessor messages :initform nil)
|
|
||||||
(headers :accessor headers :initform nil)
|
(headers :accessor headers :initform nil)
|
||||||
(ctype :reader ctype :allocation :class)
|
(ctype :reader ctype :allocation :class)
|
||||||
(responder :accessor responder)
|
(responder :accessor responder)
|
||||||
(writer :accessor writer)))
|
(writer :accessor writer)))
|
||||||
|
|
||||||
(defmethod print-object ((resp response) s)
|
(defmethod print-object ((resp response) s)
|
||||||
(shape:print-fields resp s 'messages))
|
(shape:print-fields resp s))
|
||||||
|
|
||||||
(defgeneric render-content (resp msg))
|
(defgeneric render-content (resp msg))
|
||||||
|
|
||||||
|
@ -95,8 +94,6 @@
|
||||||
(setf (writer resp) (funcall (responder resp) (list rcode headers)))))
|
(setf (writer resp) (funcall (responder resp) (list rcode headers)))))
|
||||||
|
|
||||||
(defun finish (resp)
|
(defun finish (resp)
|
||||||
(dolist (msg (messages resp))
|
|
||||||
(funcall (writer resp) (render-content resp msg)))
|
|
||||||
(funcall (writer resp) nil :close t)
|
(funcall (writer resp) nil :close t)
|
||||||
(actor:stop resp))
|
(actor:stop resp))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue