;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: modlisp -*- ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; ;;;; Name: demo.lisp ;;;; Purpose: Demonstration command processor ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Dec 2002 ;;;; ;;;; $Id: demo.lisp,v 1.1 2003/07/05 00:59:49 kevin Exp $ ;;;; ************************************************************************* (in-package #:modlisp) (defun demo-apache-command-processor (command) "Sample function to process an apache command" (let ((url (header-value command "url"))) (cond ((equal url "/fixed.lsp") (output-html-page (fixed-html-string))) ((equal url "/precompute.lsp") (with-ml-page (:precompute t) (write-precomputed-page))) (t (with-ml-page (:precompute nil) (write-debug-table command)))))) (defun write-debug-table (command) (write-string "
Key | Value |
---|---|
~a | ~a |
This is a fixed string sent by mod_lisp
" s) (write-request-counts s) (write-string "" s))) (defun write-precomputed-page () (write-string "This is a precomputed string sent by mod_lisp
" *apache-socket*) (write-request-counts *apache-socket*) (write-string "" *apache-socket*)) (defun write-request-counts (s) (format s "Number of server requests: ~D
" (get-number-server-requests)) (format s "Number of worker requests for this socket: ~D
" (get-number-worker-requests)))