Hunchentoot

from Wikipedia, the free encyclopedia

Hunchentoot is a web server and framework that was written entirely in Common Lisp , is under a free , BSD-like license , and has similar goals as the now inactive AllegroServe project. With Hunchentoot it is possible to create dynamic websites in the programming language Common Lisp; important frameworks for this language, for example the web framework UCW and the Ajax framework HT-Ajax , are also based on it.

functionality

Hunchentoot can act as an independent Web server, behind a web server includable, the as proxy can act, and using the Apache - Mods mod lisp also be incorporated directly in Apache. In each of these cases, however, a complete Common Lisp session must be running.

Portability and Distribution

Hunchentoot runs on most common Common Lisp implementations (albeit with some restrictions) and is one of the most important web servers for Common Lisp. So it can be used on most Unix-like systems.

However, he is not yet very common thing to a lack of awareness of modern Lisp - dialects could be. Potential users may also be deterred by the garbage collection used or the fact that a Common Lisp session has to run permanently. There are also alternatives for commercial users such as AllegroServe and the LispWorks web server framework .

programming

In connection with Hunchentoot and other Web servers for Common Lisp, the expressiveness and flexibility of this language is often used to HTML pages using markup - libraries generate. The following very rudimentary code example creates a simple "Hello World" page using the markup library cl-who .

  ;Einbinden der Bibliotheken, Paket definieren
  (require :hunchentoot)
  (require :cl-who)
  (defpackage hallo-welt (:use :cl :hunchentoot :cl-who))

  ;In das Paket wechseln
  (in-package :hallo-welt)

  ;Seite definieren
  (defun http-seite ()
    (with-html-output-to-string (out)
      (:html (:head (:title "Hallo-Welt-Seite"))
             (:body (:h1 "Hallo Welt")))))

  ;Webseite veroeffentlichen und Server starten
  (setf *dispatch-table* (list (create-prefix-dispatcher "/hallo-welt" 'http-seite)))
  (defvar *server* (start-server :port 8000))

The website is now under

http://hostname:8000/hallo-welt

where hostname is the host name of the server. With root rights, this example also works with port 80, of course. Hunchentoot also offers its own session system and the use of cookies . Also SSL connections are supported.

Trivia

The name Hunchentoot is borrowed from the work of the American composer and guitarist Frank Zappa . Hunchentoot is the title character of an (unreleased) musical, fragments of which found their way into Zappa's 1979 album Sleep Dirt .

Web links

Individual evidence

  1. ^ Barry Miles : Zappa , Rogner & Bernhard, Berlin 2005. ISBN 3-8077-1010-8 , p. 263.