Instaweb : Instant Web Publishing Tool

Instaweb : Instant Web Publishing Tool

By Noel Welsh (noelwelsh at yahoo dot com) 

This manual documents Instaweb version 1.4
Time-stamp: <06/06/13 12:44:10 noel>

Keywords: _instaweb_, _servlet_, _internet_, _web_


Instaweb is a simple tool that makes it easier to run
servlets in the PLT web server.

It does the following:

  - configures the web server to run a single servlet

  - runs the web server in a handy interactive shell


Simply require the instaweb library, and call the function
instaweb with the name of the servlet you want to run, and
optionally the port number and IP address to listen on.  If
the IP address is #f or not given the server will listen on
all addresses.  The servlet must be in the current


  (require (planet "" ("schematics" "instaweb.plt")))
  (instaweb "" 5678 "")

> instaweb : string [integer] [(U string #f)] -> void

The file name of the servlet 

The optional port to listen on, defaults to 80

The optional IP address to listen on, or #f (the default)
for all addresses

Tips and Caveats

If you want to run a Instaweb launched servlet on a server
you probably don't want an interactive terminal.  This is ok
-- Instaweb will detect when it doesn't have a terminal and
so avoid filling your logs with rubbish.  Say
is the file that launches your servlet.  The recommended way
to run such a setup on a server is:

  mzscheme -qr

The important bit here is the 'r' flag, which runs MzScheme
without a REPL.  You probably want to spawn a new process to
run MzScheme, and prevent signals from interferring with it,
a better line might be:

  nohup mzscheme -qr &

The web server requires servlets live in a directory called
servlets.  Hence instaweb creates this directory and copies
your servlet to it.  This means if your servlet requires any
modules using relative paths those modules probably won't be
found.  To get around this put your support modules into a
collection that you install via a .plt or Planet.  Then
require them with the (lib ...)  or (planet ...) form as

Instaweb doesn't clean up after itself.  This is a
deliberate decision as you'll probably want to populate the
web root directories with static files etc. over time.


Matthew Flatt, Jens Axel Soegaard, and Dave Herman for
suggestions for dealing with a missing terminal, and
suspending the main thread

Eric Hanchow, for pointing out documentation typos