Updated: 11/5/2005; 6:08:12 PM.
Chris Double's Radio Weblog
        

Thursday, December 30, 2004

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      

Bill Clementson comments on the recent Developerworks article on continuation based web programming and lists lots of links to discussions on the subject.

11:59:00 AM      

© Copyright 2005 Chris Double.
 
December 2004
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Nov   Jan



Click here to visit the Radio UserLand website.

Listed on BlogShares

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.