[plt-scheme] unit/sig servlets and the repl

From: matthias at ccs.neu.edu (matthias at ccs.neu.edu)
Date: Wed Dec 22 19:41:23 EST 2004

We do not have a good way yet to develop and test servlets from within
drscheme. Personally I use the servlet teachpack and thne refactor the
result into a servlet. BUT: (1) The development process is subpar and (2)
the refactoring is complicated and error-prone. 


Greg P. is working on this issue for now. It's his job for next semester to
produce something better.  


-- Matthias


On December 22, 5:20 pm Bob McCormick <bobm at adt.com> wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> Is it possible to use the repl to debug/test servlets?    For
> example, if load the add.ss example servlet (reproduced below) into
> DrScheme and click "Run", trying to call the "request-number"
> function from the repl gives the error  "reference to undefined
> identifier: request-number".
> Is there a trick I'm missing to be able to use the REPL to
> interactively debug and test servlets?  Should I use the  module
> based servlet interface instead?
>
> ----------- add.ss (from the servlet/examples directory)---------
> (require (lib "unitsig.ss")
>           (lib "servlet-sig.ss" "web-server")
>           (lib "servlet-helpers.ss" "web-server")
>           (lib "date.ss"))
>
> (unit/sig () (import servlet^)
>
>    ; 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"])))))))
>
>    `(html (head (title "Sum"))
>           (body ([bgcolor "white"])
>                 (p "The sum is "
>               ,(number->string (+ (request-number "first")
> (request-number "second")))))))
>



Posted on the users mailing list.