Component redirect-handler

You are here: All Systems / araneida / main / redirect-handler

(in-package :araneida)

;;; when moving resources around, it's important not to break old URLs

(defclass redirect-handler (handler)
  ((location :initarg :location :accessor redirect-location))
)


(defmethod handle-request-response ((handler redirect-handler) method request)
  (let* ((loc (redirect-location handler))
         (base (typecase loc
                 (url loc)
                 (string (merge-url (request-base-url request) loc))
)
)
)

    (request-redirect request
                      (merge-url base (request-unhandled-part request))
)
)
)


Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.