[plt-scheme] Servlets and diagnosing a blank screen

From: Ben Simon (benjisimon at gmail.com)
Date: Fri Apr 24 14:28:11 EDT 2009


I was working on some code which produced a bunch of output.  To make it
easier to read, I decided to generate HTML and look at in the browser. And
as long as I was generating HTML, I figured what the heck, I should turn my
code into my very first servlet.

So I hastily through together the following code:

;; --+--+--
(define (foo-servlet request)
     (title "Foo App"))
     (form ((method "POST"))
           (input ((type "text") (name "q")))
           (input ((type "submit") (value "Go!"))))
     ,(if (exists-binding? 'q (request-bindings request))
          (let ([results (do-foo (extract-binding/single 'q
(request-bindings request)))])
              ,@(for/list ([r results])
                  `(li (a ((href ,(result-url r))) ,(result-value r))))))
          "-- Enter a Foo arg --"))))

(serve/servlet foo-servlet
               #:port 8002
               #:servlet-path "/")
;; --+--+--

And holy smokes, it worked!  In no time I was interactively testing `foo'.
And when foo failed, I got a big 'ol exception stacktrace. Again, all good.

But, for some arguments that I pass to `foo' the browser churns and then
ends at a blank screen. No exception is thrown, no error message is given.

If I had to wager a guess, I'd say that my call to (do-foo ...) was taking
to long.

So, my questions are:

1) Any suggestions for pinpointing an issue where the response is just a
blank page (with not HTML) returned?

2) What's the best way to change the connection timeout?  I've tried
adjust-timeout! , but that doesn't change anything and I'm not convinced
it's changing the timeout I want it to change. I see
adjust-connection-timeout! but I'm not sure how I would use this with

Thanks in advance,,

Have an idea for software?  I can make it happen -
My Blog: http://benjisimon.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090424/a201327f/attachment.html>

Posted on the users mailing list.