All objects that can be displayed on a client browser in IMHO derive
in some way from html-element
. IMHO objects are
ordinary CLOS objects, and can be defined,
redefined, and created using standard CLOS syntax. Classes for basic
elements can be defined by subclassing
html-element
. Once a class has been defined,
it can be used to 'display' part of a response to an HTTP request.
Here's a very simple IMHO application:
(defclass hello-world (html-element) ) (defmethod render-html ((element hello-world) stream) (format stream "Hello World!")) (defapplication hello-world-app :base-url "hello" :initial-element hello-world) |
If the mod_webapp is configured to serve applications under "/imho" (the so-called 'mount point'), then once running, this application could be invoked at a URL that looks like this:
http://127.0.0.1/imho/hello |
Note: The first time you start up any IMHO application, IMHO will attempt to bind to imho::*lisp-server-port* in order to recieve requests from your JServ adaptor. If you started a Java VM to handle JServ requests, you should kill it, or move it to another port, or configure your JServ mount point for IMHO and imho::*lisp-server-port* to use a different port for their communications.
To provide display behavior via a template, a file named "hello-world.html", containing the single line:
Hello World! |