On Tue, 2010-09-07 at 18:20 +0200, Michel Onoff wrote: > By specification, HTTP response 304 Not Modified has no entity. > > However, getEntity() on the BasicHttpResponse still returns a non-null > entity. Trying to getContent() and read() then blocks. The same happens > if one tries to send the response with > HttpServerConnection.sendResponseEntity(response). > > Is this supposed to be correct behavior? In other words, must the > programmer be aware of which responses might have an entity? Why can't > he rely on the return value of getEntity()? >
Michel, BasicHttpResponse does not have any protocol specific logic. It is merely a bean with properties. It is the responsibility of the protocol processor to assign an instance of HttpEntity to the response object if a response content is expected. I am fairly confident the standard HTTP protocol processors handle 304 Not Modified responses correctly http://hc.apache.org/httpcomponents-core-4.0.1/httpcore/xref/org/apache/http/protocol/HttpRequestExecutor.html#290 http://hc.apache.org/httpcomponents-core-4.0.1/httpcore/xref/org/apache/http/protocol/HttpRequestExecutor.html#83 What is it exactly you are trying to do and what module (HttpCore, HttpCore NIO, HttpClient) are you using? Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
