[plt-scheme] send/suspend: when the response relies on the request

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sat Aug 13 07:30:59 EDT 2005

When send/suspend is used, there is always _a_ request in scope. For example:

(module s mzscheme
  (require (lib "servlet.ss" "web-server"))
  (provide (all-defined))
  (define timeout 120)
  (define interface-version 'v1)
  (define (start request0)
    (let ([request1 (send/suspend (lambda (k) (something-with request0)))])
      (something-with request1))))

Jay

On 8/13/05, Dave Herman <dherman at ccs.neu.edu> wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> The type of send/suspend is (string -> response) -> request, which means
> that the continuation argument must create a response without seeing the
> request. But sometimes you need to see the request bindings to generate
> the response properly.
> 
> A common example is that XHTML is supposed to be generated with the
> Content-type: application/xhtml+xml, but only if the client browser
> sends an HTTP_ACCEPT binding (in the request) that includes that MIME
> type. So you need to be able to view the request bindings in order to
> generate a Content-type header in the response with make-response/full.
> 
> Is there any way to do this?
> 
> Thanks,
> Dave
> 
> 


-- 
Jay McCarthy <jay at cs.brown.edu>
http://jay.makeoutcity.com/



Posted on the users mailing list.