[plt-scheme] web-server/servlet-env in SVN supports top-level servlets and multiple-servlets

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Nov 7 14:23:22 EST 2008

The following module:

#lang scheme
  (require web-server/servlet
           web-server/servlet-env)

  (define (my-app request)
    `(html (head (title "Hello world!"))
           (body (p "Hey out there!"))))

  (serve/servlet my-app
                 #:servlet-path "/")

Captures the top-level "/" URL.

Change it to
  (serve/servlet my-app
                 #:servlet-path "/"
                 #:servlet-regexp "")

And it captures every request.

In the first case, servlets from the web-server's default directory
will be served as well. This can be overridden with #:servlets-root or
#:server-root-path.

Jay

-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://jay.teammccarthy.org

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.