Conrad Barski has a tutorial on using Sisc Scheme with Tomcat for continuation based web applications.
I do similar for deploying applications but for development I prefer a
REPL where I can enter code, change things, and immediately hit refresh
in the browser to see the changes.
I do this with Sisc I use Jetty
as the web server. I drive Jetty using Sisc. That is, I instantiate the
code web server instance and start it up using something like:
(define (start-server port) (let ((server (java-new <jetty-server>)) (listener (java-new <socket-listener>))) (set-port listener (->jint port)) (add-listener server listener) (start server) server))
(define *server* (start-server 9080))
With this I get a server running under the REPL and can do things like:
(define (menu-page url) `(html (head (title "Menu")) (body (ul (li ,(function-href "Form Page" run-form-page-function)) (li ,(function-href "Run Many Pages" run-many-pages)) (li ,(function-href "My name page" run-my-name-page)))))) (register menu-page)
The result from 'register' gives me an URL I can immediately access
from the browser to display and test the page. This gives me something
like what I'm used to from Common Lisp web servers like AllegroServe but with continuation based development.
I have a custom servlet which does the dispatching to Scheme from web
requests which I haven't shown here but is similar to the one in the
Sisc Scheme Tomcat example.
Although I do this for development purposes it can also be used for
production servers if you use Jetty. I use something like 'screen' or
'detachtty' to detach the REPL and attach to it when I want to patch or
modify the system.
When I first introduced Scheme to my workplace most of the developers
used the Tomcat style approach and had to 'compile' things everytime
changes were made, bring the application down, etc. As I've introduced
the REPL style development it's definitely helped sell them on Scheme
and interactive development.
1:00:26 PM
|
|