I'm trying to write a servlet that plugs into the existing server. Here's an example:<div><br></div><div><div>#lang racket</div><div>(require web-server/servlet-env)</div><div>(require web-server/http/bindings)</div>
<div>(require web-server/http/response-structs)</div><div>(require web-server/http/xexpr)</div><div><br></div><div>(require racket/sandbox)</div><div>(define lazy-eval (make-evaluator 'lazy))</div><div><br></div><div>
(map lazy-eval</div><div> '(</div><div> (require web-server/http/bindings)</div><div> (require web-server/http/response-structs)</div><div> (require web-server/http/xexpr)</div><div> (require racket/promise)</div>
<div> (define (lazy-handler request)</div><div> (let ((bindings (request-bindings request)))</div><div> (if (exists-binding? 'hi bindings)</div><div> (response/xexpr "Hi!")</div>
<div> "")))</div><div> ))</div><div><br></div><div>(define (start request)</div><div> (force ((lazy-eval 'lazy-handler)</div><div> request)))</div><div><br></div><div>(serve/servlet start</div>
<div> #:launch-browser? #f</div><div> #:quit? #f</div><div> #:listen-ip #f</div><div> #:servlet-path ""</div><div> #:port 8080</div><div> #:servlet-regexp #rx"main.*"</div>
<div> #:extra-files-paths</div><div> (list (build-path (current-directory) "extraFiles")))</div><br><div class="gmail_quote">On Wed, Mar 21, 2012 at 6:22 AM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
On Mar 21, 2012, at 5:18 AM, Nathan Breit wrote:<br>
<br>
> Hi,<br>
> I'm trying to implement a Racket web-server handler that does lazy evaluation. My approach so far as been to try making a evaluator/namespace that uses the lazy racket, then evaluate a function in it that returns a lazy request handler. However, I'm running into problems getting the handler to read the request object. My last resort will be to make a request serializer and pass serialized requests into the handler, but is there a better way?<br>
> Thanks,<br>
> -Nathan<br>
</div></div>> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
<br>
<br>
Are you trying to write a web server in Lazy or are you trying to write a servlet in Lazy and plug it into the existing strict server? Perhaps you want to post a code snippet that shows where things fail. -- Matthias<br>
<br>
</blockquote></div><br></div>