[plt-scheme] servlet2.ss, servlet.ss, etc.

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Mar 26 08:36:46 EDT 2007

I'm not sure about the paper, but the basic thing that those modules
do is run the web-server embedded in DrScheme. You can still do that
with the following code:

--- Copied from another message ----

One thing you can do to run the web-server from within DrScheme is to
use the (lib "servlet-env.ss" "web-server" "tools") library. Here's an
example:

(module servlet-env-test mzscheme
 (require (lib "servlet-env.ss" "web-server" "tools"))

 ; request-number : str -> num
 (define (request-number which-number)
  (string->number
   (extract-binding/single
    'number
    (request-bindings (send/suspend (build-request-page which-number))))))

 ; build-request-page : str -> str -> response
 (define (build-request-page which-number)
  (lambda (k-url)
    `(html (head (title "Enter a Number to Add"))
           (body ([bgcolor "white"])
                 (form ([action ,k-url] [method "post"])
                       "Enter the " ,which-number " number to add: "
                       (input ([type "text"] [name "number"] [value ""]))
                       (input ([type "submit"] [name "enter"] [value
"Enter"])))))))
 #;(on-web
 `(html (head (title "Sum"))
        (body ([bgcolor "white"])
              (p "The sum is "
                 ,(number->string (+ (request-number "first")
(request-number "second")))))))

 (on-web (+ (request-number "first") (request-number "second"))))

When you use the `on-web' function, a temporary server is run from
DrScheme on port 8080 and a browser window is opened to a temporary
servlet. This should help you test servlets from DrS.

On 3/25/07, Ethan Herdrick <info at reatlas.com> wrote:
> Hi
>
> I've got a question about Matthias' remarkable 2002 paper, "Developing
> Interactive Web Programs" (here:
> http://www.ccs.neu.edu/scheme/pubs/afp2002-f.ps).
>
> Does any of the code described in the paper work anymore?  I notice it
> can be found in PLT/collects/htdp/servlet2.ss but it doesn't seem to
> work.  Has it been superseded by servlet.ss?  Most of the (names of)
> functions defined in htdp/servlets2.ss seem to be there.  (There's no
> "inform" function in servlet.ss, though.)
>
> Thanks in advance.
>
> -Ethan
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


-- 
Jay McCarthy <jay.mccarthy at gmail.com>
http://jay.teammccarthy.org


Posted on the users mailing list.