I’m looking to do some synchronous web-programming in Common Lisp, and I’m rounding up options. One of them is sw-http, an “HTTP server tailored for AJAX/Comet”. The documentation seems to be a bit lacking because the only piece I could find tells you to
Sub-class SERVER and set the APPLICATION-FINDER-FN slot to a callback
that generates your content.
There doesn’t seem to be any notes or examples about what that callback should look like (some prodding told me that it should expect a server and a connection as arguments, but nothing about what it should return or do).
setting it to something naive like
(lambda (server conn) (declare (ignore server conn)) "Hello world")
doesn’t seem to do anything, so I assume I either need to write to a stream somewhere or interact with the server/connection in some less-than-perfectly-obvious way.
Any hints?
The handler takes a
connectionwhich has aresponsewhich has somechunks.Presumably you’re to add your content to the
chunks(which areoctets) of theresponseof theconnection. Luckily there are some helper methods defined to make this easier.You might try this (I couldn’t get SW-HTTP to compile so I can’t):
Good luck!