[Web-SIG] [server-side] request/response objects

Simon Willison cs1spw at bath.ac.uk
Wed Oct 29 19:26:34 EST 2003

Bill Janssen wrote:

> I think you can separate them and combine them at the same time,
> without much trouble.  For instance, Ian used the example
> "request.response.write()", implying that the response object is
> accessible from the request object, which makes sense to me.  So in
> one view, there's just one object, the request, and the response
> object is just a part of that.  But for those who prefer it, it's easy
> to assign
>    response = request.response
> and deal with the two different variables.

I have to admit I prefer keeping the two completely separate, as is done 
by the Java servlet specification. As mentioned by someone else, the big 
difference between the two is that request should be read only while 
response can have its state altered. An advantage of this is that you 
can potentially do interesting things with the two objects - like 
pickling the request object and logging it somewhere, or pickling the 
response object and caching it once it has been populated to speed up 
future requests for the same data.

I can see the POV of people who prefer a single object or nested objects 
as well though. This is going to be a tricky issue to resolve. If there 
are no utterly convincing arguments for one approach or the other we 
could take it to a vote?

Simon Willison
Web development weblog: http://simon.incutio.com/

More information about the Web-SIG mailing list