You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Fredrik Herbertsson <fr...@om.com> on 2003/03/13 13:26:55 UTC

How to get access to individual chunks in chunked response?


HI,

Is it possible using HttpClient to get access to individual chunks in an chunked
response?
Further, does the HTTP standard allow a HTTP-server to send MORE than one (full,
i.e. last chunk of size 0 sent) HTTP/1.1 200 responses for one request?

The problem I'm trying to solve is to make a request on a particular connection,
get a response (including data I need. In my case an application session id) and
then further wait for an application notification. The mentioned connection is a
notification channel used to notify client when certain application events
occur.

 I've been looking at the source for the ChunkedInputStream and as far as I can
see it is not possible to get hold of the chunks. (As it probably shouldn't be
since the stream is supposed to abstract stuff like that away :-). I only seem
ta have access to the full response. Is it possible to receive another (chunked)
response on the used InputStream? I't looks that the EOF flag is set when the
Last-Chunk is received and successive calls to read will immediately return -1,
making the stream useless for further responses. Is it possible to re-use the
connection (underlying Socket) and get a stream that reads from the same
underlying connection?

... or do I have to use 'raw' sockets on the client-side and parse the response
including the HTTP stuff :-(

Regards
/Fredrik Herbertsson