r5235: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 5 Jul 2003 00:59:49 +0000 (00:59 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 5 Jul 2003 00:59:49 +0000 (00:59 +0000)
debian/rules
demo.lisp [new file with mode: 0644]

index bd42b3703f656004686112adc905290783772adc..14b38fa2435daadcdf6735fb9ace1814b25da950 100755 (executable)
@@ -63,7 +63,7 @@ binary-arch: build install
 #      dh_installman
 #      dh_installinfo
 #      dh_undocumented
 #      dh_installman
 #      dh_installinfo
 #      dh_undocumented
-       dh_installchangelogs Changelog
+       dh_installchangelogs 
        dh_strip
        dh_compress
        dh_fixperms
        dh_strip
        dh_compress
        dh_fixperms
diff --git a/demo.lisp b/demo.lisp
new file mode 100644 (file)
index 0000000..87c0aac
--- /dev/null
+++ b/demo.lisp
@@ -0,0 +1,67 @@
+;;;; -*- 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 "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
+<html><head></head>
+<body>
+<h1>mod_lisp debug page</h1>" *apache-socket*)
+  (write-request-counts *apache-socket*)
+  (write-string "<table>
+<thead><tr><th>Key</th><th>Value</th></tr></thead>
+<tbody>" *apache-socket*)
+  (loop for (key . value) in command do
+       (format *apache-socket* "<tr><td>~a</td><td>~a</td></tr>" key value))
+  (write-string "</tbody></table></body></html>" *apache-socket*))
+
+
+(defun fixed-html-string ()
+  (with-output-to-string (s)
+    (write-string
+     "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
+<html><head></head><body><h1>mod_lisp fixed page</h1>
+<p>This is a fixed string sent by mod_lisp</p>" s)
+    (write-request-counts s)
+    (write-string "</body></html>" s)))
+
+(defun write-precomputed-page ()
+  (write-string
+   "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
+<html><head></head><body><h1>mod_lisp precomputed page</h1>
+<p>This is a precomputed string sent by mod_lisp</p>" *apache-socket*)
+  (write-request-counts *apache-socket*)
+  (write-string "</body></html>" *apache-socket*))
+
+(defun write-request-counts (s)
+  (format s "<p>Number of server requests: ~D</p>"
+         (get-number-server-requests))
+  (format s "<p>Number of worker requests for this socket: ~D</p>"
+         (get-number-worker-requests)))
+
+
+