Miscellaneous
This page features some miscellaneous routines for use with CL-HTTP.
Error message signature
The default CL-HTTP error message includes a link to the CL-HTTP home page in the footer. You can customise this to a link to your site with a routine such as the following:
(define cl-http-signature (&optional (stream *output-stream*))
(with-emphasis (:address :stream stream)
(note-anchor "Plasticki" :reference "http://www.plasticki.com/" :stream stream)))
Page not found redirect
The default behaviour for an illegal URL is to display a Not Found error message. The following routine can be used to catch this condition, and cause it to give a redirect to the site's home page:
(defmethod report-status-message ((condition document-not-found)
stream &optional format-string format-args)
(html4.0::with-html-document (:declare-dtd-version-p :transitional :stream stream)
(with-document-preamble (:stream stream)
(declare-title "Page Not Found" :stream stream)
(declare-meta-info "0; url=http://www.plasticki.com/" :header :refresh :stream stream))
(with-document-body (:stream stream)
(write-string "Page Not Found - Redirecting to Home Page" stream))))blog comments powered by Disqus
