From 0d8fd57920b0b69fb8969eba0a82edb09a79029d Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 26 Jul 2024 16:16:53 +0200 Subject: [PATCH] web/response: re-arrange code, esp. interaction stuff --- web/response.lisp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/web/response.lisp b/web/response.lisp index e537a47..edac204 100644 --- a/web/response.lisp +++ b/web/response.lisp @@ -11,6 +11,20 @@ (in-package :scopes/web/response) +;;;; server interaction - receive response message from action processing chain + +(defclass interaction () + ((messages :accessor messages :initform nil))) + +(defmethod print-object ((ia interaction) s) + (format s "" (messages ia))) + +(defmethod core:send ((ia interaction) msg) + (log:debug "receiving ~s" msg) + (push msg (messages ia))) + +;;;; response definitions + (defvar *html-response-class* nil) (defclass response () @@ -26,18 +40,6 @@ (defclass json-response (response) ((ctype :initform "application/json"))) -;;;; server interaction - receive response message from action processing chain - -(defclass interaction () - ((messages :accessor messages :initform nil))) - -(defmethod print-object ((ia interaction) s) - (format s "" (messages ia))) - -(defmethod core:send ((ia interaction) msg) - (log:debug "receiving ~s" msg) - (push msg (messages ia))) - ;;;; html response (defclass html-response (response) @@ -75,8 +77,6 @@ (dolist (msg (messages iact)) (funcall writer (render-content resp msg))) (funcall writer nil :close t))))) - ; (content (mapcar #'(lambda (m) (render-content resp m)) (messages iact)))) - ;(list rcode headers content))) (defun render-not-found(resp) (list 404 '(:content-type "text/plain") '("Not found")))