Extending CL-HTTP

Computing Responses

Dynamically computed Web pages are the forte of this server. These computed responses are written in LISP, which supersedes legacy CGI interfaces. See the documentation on computing responses.

Exporting CGI Scripts

The server provides a Common Gateway Interface via the macro http:with-cgi-environment that is useful when writing new export methods that need to invoke invoke conventional scripts outside of Common Lisp via the CGI 1.1 standard. These export methods should be specialization of the URL class URL:COMPUTED-URL.

Defining New Mime Types

In general New MIME types is needed primarily when you want to export a new MIME content type, either from static files or dynamic computations. http:define-url-export-type automatically defines new MIME types when it sets up a new export types. Here is an example:

(http:define-url-export-type
	:shockwave-file	                ;Export Type
	:dir		                ;Primary Extension
	(:application :x-director)	;MIME Type
	:copy-mode :binary	        ;Binary Content
	:alternate-extensions (:dcr))	;Other Extensions

When no corresponding export type is required, you may use http::define-mime-content-type.

Writing New Export Methods

In order to add new export types, you need to write methods for the generic functions:

A new export type is appropriate when existing ones cannot do the job you require. It is important to consider whether and existing export type could be generalized to meet your requirements before embarking on a new export type. If your new operation is not idempotent (i.e., side effects on the server), you should define method for POST-DOCUMENT instead. Earlier versions of the HTTP specification included additional methods, like PUT, DELETE, and LINK, which may be reinstated when their application becomes apparent.

John C. Mallery -- jcma@ai.mit.edu
M.I.T. Artificial Intelligence Laboratory