- ((or symbol function)
- (when (and (symbolp handler)
- (not (fboundp handler)))
- (cmsg "handler given a symbol without a function ~S" handler)
- (return-from handle-request nil))
- (let ((next-page (funcall handler req ent)))
- (typecase next-page
- (string
- (redirect-entity next-page req ent))
- (cons
- (redirect-entity (car next-page) req ent (cadr next-page)))
- (null
- t)
- (t
- (cmsg "handler should return nil or a string, not ~S" next-page))))
- t)
+ (list
+ (let ((next-handler (first handlers)))
+ (setf (entity-generators ent) (cdr handlers))
+ (when (and (symbolp next-handler)
+ (not (fboundp next-handler)))
+ (cmsg "handler given a symbol without a function ~S" next-handler)
+ (return-from handle-request nil))
+ (let ((next-page (funcall next-handler req ent)))
+ (typecase next-page
+ (string
+ (setf (entity-generators ent) nil)
+ (redirect-entity next-page req ent))
+ (cons
+ (setf (entity-generators ent) nil)
+ (redirect-entity (car next-page) req ent (cadr next-page)))
+ (keyword
+ (if (eq :continue next-page)
+ (handle-request (cdr handlers) req ent)
+ (add-log-entry "Invalid return keyword ~S" next-page)))
+ (null
+ t)
+ (t
+ (cmsg "handler should return nil or a string, not ~S" next-page))))
+ t))