[plt-scheme] Servlets and diagnosing a blank screen

From: Ben Simon (benjisimon at gmail.com)
Date: Sat Apr 25 22:44:49 EDT 2009

On Fri, Apr 24, 2009 at 2:33 PM, Jay McCarthy <jay.mccarthy at gmail.com>wrote:

> On Fri, Apr 24, 2009 at 12:28 PM, Ben Simon <benjisimon at gmail.com> wrote:
> > 1) Any suggestions for pinpointing an issue where the response is just a
> > blank page (with not HTML) returned?
>
> That can happen when you don't return a valid response object in some
> contexts, also if you were to return an infinite (because of cycles)
> one, or if you went into an infinite loop.


Thanks, good to know.


> > 2) What's the best way to change the connection timeout?
>
>
> serve/servlet doesn't support a connection timeout like running from
> the commandline does, but you can give a different manager argument to
> keep continuations longer. If you want to get a longer timeout on the
> connections, you'd have to construct a dispatcher like the one in
> web-server/web-config-unit, possibly using the helpers that
> serve/servlet uses.


Using the source code for web-server/servlet-env.ss as inspiration, I've
come up with:

;; ----------------------------
(require web-server/servlet-dispatch
           (prefix-in timeout: web-server/dispatchers/dispatch-timeout)
           (prefix-in seq: web-server/dispatchers/dispatch-sequencer))

(serve/launch/wait
 (lambda (sema)
   (seq:make (timeout:make 6000)
             (dispatch/servlet foo-servlet #:regexp #rx"")))
 #:port 8002)
;; ----------------------------

and now I don't get blank screens anymore.

I'm impressed at how easy it was to make my own dispatcher. Cool stuff.

Thanks Jay!

-Ben


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

Posted on the users mailing list.