hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Are requests and responses self-contained?
Date Fri, 29 Jul 2011 22:12:27 GMT
On Fri, 2011-07-29 at 20:10 +0200, Michel Onoff wrote:
> Hello,
> 
> consider the following code, which form some reason assumes that
> requests have enclosing entities
> 
> // conn is a DefaultHttpServerConnection, for example
> req1 = (HttpEntityEnclosingRequest) conn.receiveRequestHeader();
> conn.receiveRequestEntity(req1);
> 
> req2 = (HttpEntityEnclosingRequest) conn.receiveRequestHeader();
> conn.receiveRequestEntity(req2);
> 
> Can I later say req1.getRequestLine() or req1.getEntity(), even if in
> the meantime I got req2 from the same connection?

No, you can't. You cannot obtain the second request object from the
connection before the request entity of the first one has been fully
consumed. 

> In other words, are requests fully self-contained and totally
> independent from the connection once both the header and the entity (if
> existing) have been received?
> 

No, they are not, if content entities are being streamed (not buffered
in memory).   

hope this helps

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message