1 Using Instaserlvet
2 Instaservlet API
2.1 How The Servlet Is Run


Instaservlet is the fastest way to get a servlet running in the web server. You provide a function that takes a request and returns a response. Instaservlet sets up the web server with sensible defaults, and runs your servlet in a wrapper that handles the details of instance and continuation expiry for you.

1 Using Instaserlvet

Using Instaservlet is as simple as requiring the Instaservlet module and calling go! with your servlet function. For example, the following is a complete servlet that uses Instaservlet to handle all web-server configuration:


   (planet "instaservlet.ss" ("untyped" "instaservlet.plt" 1)))


  (define (servlet request)

    '(html (head (title "It's working!"))

           (body (h1 "Instaservlet is in the house!"))))


  (go! servlet)

That is basically all there is to Instaservlet. By default the web-server listens on port 8765 to connections from the localhost only. You can change this by passing optional arguments to "go!". See the Instaservlet API for details.

2 Instaservlet API

To start you will want to require the Instaservlet module, which has the PLaneT form:

(planet "instaservlet.ss" ("untyped" "instaservlet.plt" 1))

The main function is go!










#:port port







#:listen-ip listen-ip







#:htdocs-path htdocs-path







#:mime-types-path mime-types-path







#:servlet-namespace servlet-namespace])




  servlet : (-> request any)

  port : integer/c = 8765

  listen-ip : string? = ""






(listof (or/c path? string?))







  mime-types-path : path? = default-mime-types-path






(listof require-spec)







Runs the given servlet in a web-server that has been setup (using Instaweb) with the given parameters (all of which are optional). By default the web server runs on port 8765 and listens only to connections from the localhost. Refer to the Instaweb documentation for more details.

2.1 How The Servlet Is Run

Instaweb takes care of some important servlet configuration details for you:

These settings will be made customisable in future releases on Instaservlet.