LispOS: LispEnv or Tunes?

Rainer Joswig
Sat, 3 May 1997 00:39:26 +0200

At 12:32 Uhr -0700 2.5.1997, Kelly Murray wrote:

>I believe SilkScript is *easy* to learn -- you don't need to know

>already to use it.

>This is the problem with CL-HTTP - you have to be a lisp expert to

>it, and I believe it actually makes everything MORE complicated

>instead of simpler.

CL-HTTP implements a complete infrastructure for doing web things.

It tries to actually handle HTTP. It does support all

the HTTP stuff and more. HTTP *is* complicated.

It handles for example the HEAD command.

Take this CL-HTTP code for getting the modified date

of a page.

(defun <bold>get-url-modified-date</bold> (url headers)


    (http::handling-redirects (url)

      (http::handling-authentication (authorization)


          (url :head 



                                 :authorization authorization

                                 :header-plist headers))

          http::remote-stream				;ignore 

          (http::with-status-code-dispatch (:client http::client

                                            :url url

(http::client-status http::client))

            (http:get-header :last-modified http::*headers*)))))

    (http::http-condition (cond) cond)))

? <bold>(http-user::get-url-modified-date (url:url
"") nil)



? <bold>(http-user::get-url-modified-date (url:url
"") nil)


I mean, by implementing only the parts of HTTP/HTML my web server would

simpler, too. I just would like to have a MODIFIED header as a response

a HEAD request to see whether your page has changed without actually

getting the page itself.

CL-HTTP has a lot of features that will make dealing at a programmer

level with HTTP simpler. If you want to create own services on top

of CL-HTTP you sure may implement libraries which makes it easier

for less experienced people. In my own code I just

end up doing MAKE-INSTANCE on page objects:

(defparameter *explanations-page*

  (make-instance 'als-explanations-page

    :title "Begriffe"

    :url #u"/als/begriffe"

    :body-function 'als-explanations

    :file (pathname "als:Leasingbegriffe;Begriffe.tabdel")

    :search-url #u"/als/begriff?"))

With a body function like this:

(defmethod als-explanation ((page als-explanation-page) url stream)

  (let* ((explanation-word-string (and (url:search-keys url)

                                       (string-trim '(#\space #\tab)

(url:search-keys url)))))

         (explanation (find explanation-word-string *explanations*

                            :key #'explanation-word-string

                            :test #'equalp)))

    (princ "Alle Begriffe: " stream)

    (html:note-anchor "&Uuml;berblick"

                      :stream stream

                      :reference "/als/begriffe")

    (html:break-line :stream stream)

    (when (explanation-previous explanation)

      (princ "Vorheriger Begriff: " stream)

      (html:note-anchor (explanation-word-string (explanation-previous

                        :stream stream

                        :reference (concatenate

                                    'string "/als/begriff?"



    (html:break-line :stream stream)

    (when (explanation-next explanation)

      (princ "N&auml;chster Begriff: " stream)

      (html:note-anchor (explanation-word-string (explanation-next

                        :stream stream

                        :reference (concatenate

                                    'string "/als/begriff?"



    (html:break-line :stream stream)

    (html2:with-section-heading ((explanation-word-string explanation)
:level 2 :stream stream)

      (loop for sentence in (explanation-sentences-strings

            do (or (maybe-insert-explanation-anchor sentence "Siehe: "

                   (maybe-insert-explanation-anchor sentence "Siehe
auch: " stream)

                   (princ sentence stream))

            do (html:new-paragraph :stream stream)))))

Rainer Joswig, Lavielle EDV Systemberatung GmbH & Co, Lotharstrasse 2b,

Hamburg, Tel: +49 40 658088, Fax: +49 40 65808-202,

Email: , WWW: