You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Florent Georges <li...@fgeorges.org> on 2009/12/12 14:21:45 UTC

How to read chunked response entity? (hc 4.0.1)

  Hi,

  I send a GET request to a server which responds with a chunked
entity content.  I've looked in the documentation, but I only
found info about how to produce chunked content in a request, not
about how to consume chunked content from a response.

  Did I miss something?  How can I retrieve the entity content?
I use HttpCore 4.0.1 and HttpClient 4.0.1.

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/




















      


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


Re: How to read chunked response entity? (hc 4.0.1)

Posted by Florent Georges <li...@fgeorges.org>.
Sam Crawford wrote:

> It's demonstrated right at the top of
> http://hc.apache.org/httpcomponents-client/tutorial/html/fundamentals.html
> - that will work for both chunked and non-chunked responses.

  "Chapter 1. Fundamentals"  Ouch! :-)

  If I am right, you mean just reading the content InputStream,
regardless of the Transfer-Encoding.  Ahem, this is what I did,
in a separate, reproducible, standalone main class, and it
failed.  And now that I re-run this "reproducible" example, it
works :-/  Quite embarrassing...

  Sorry for the noise, and thanks for the reminder of the
tutorial!  Regards,

-- 
Florent Georges
http://www..fgeorges.org/




















      


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


Re: How to read chunked response entity? (hc 4.0.1)

Posted by Sam Crawford <sa...@gmail.com>.
It's demonstrated right at the top of
http://hc.apache.org/httpcomponents-client/tutorial/html/fundamentals.html
- that will work for both chunked and non-chunked responses.

As you probably know, you won't be able to call getContentLength() on
a chunked response entity. You just have to read the InputStream until
EOF.

Thanks,

Sam


2009/12/12 Florent Georges <li...@fgeorges.org>:
>  Hi,
>
>  I send a GET request to a server which responds with a chunked
> entity content.  I've looked in the documentation, but I only
> found info about how to produce chunked content in a request, not
> about how to consume chunked content from a response.
>
>  Did I miss something?  How can I retrieve the entity content?
> I use HttpCore 4.0.1 and HttpClient 4.0.1.
>
>  Regards,
>
> --
> Florent Georges
> http://www.fgeorges.org/
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

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