[racket] web server: response terminates servlet?

From: George Neuner (gneuner2 at comcast.net)
Date: Fri Nov 21 01:37:53 EST 2014

Hi Jay,

On 11/20/2014 9:39 AM, Jay McCarthy wrote:
> A response is a value. The various response/* functions just return
> these values. A servlet is a "request -> response" function, which
> means that the response you send back is the value the servlet
> returns.

I think that's where I got the idea that the response/...  functions 
terminated the servlet.  There are a few examples in which response/... 
is the final function called in the servlet, but there aren't any 
examples that show sending a response from the middle except for those 
invoking the send/... functions.  But those examples also involve saving 
continuations so I associated send/... with continuation saving.

> Your use of an escape continuation to simulate C's "return"
> statement is standard practice. However, the Web server offers an
> effect function called 'send/back' with the type "response -> doesn't"
> that will accept a response and send it back to the user, never
> returning to the code that called it. I suspect you will find it nicer
> to use this if you know the function isn't returning the response to a
> DIFFERENT function that post-processes the response.

Thanks, that look's like what I want.  The idea here is that the input 
is invalid so the servlet can't continue.

> Jay

George


Posted on the users mailing list.