Re: CL-HTTP

"Karsten Poeck" <[email protected]> Tue, 24 Jun 2003 00:47:51 +0200
Newsgroups gmane.lisp.cl-http
Message-ID <[email protected]>
"Cristina Gema Muñoz Maya" <[email protected]> wrote in message
news:[email protected]...
Hello!

          I haven't got to do anything with CL-HTTP. Could you please send
me some easy example you have? Something like a "Hello World" example, with


Hola,

here is my easiest example with a computed form for cl-http.
Put the code whereever you like, doesn't matter.

just marcoexapand #u/easy-test to see the url the code is used for

(in-package :cl-user)

(defun blah-clhttp (url stream)
  (generate-blah-clhttp url stream))

(defun generate-blah-clhttp (url stream)
  (declare (ignore url))
  (http:with-successful-response (stream :html)
    (let ((title "foo"))
      (http::with-html-document (:stream stream)
        (html:with-document-preamble (:stream stream)
          (html:declare-title title :stream stream))
                               (html:with-standard-document-body (:stream
stream :color-scheme nil)
                                 (format stream "bar"))))))

(http:export-url #u"/easy-test"
            :computed
            :response-function #'blah-clhttp
            :expiration '(:no-expiration-header)
            :public t
            :no-cache t
            :language :en
            :keywords '(:cl-http :demo)
                 :documentation "test")

Karsten