On Wed, 2010-12-01 at 10:50 -0800, yoosh wrote: > Hi, > > I've searched the forum: > > http://old.nabble.com/Opening-streaming-URL-td11290919.html#a11344350 > http://old.nabble.com/Opening-streaming-URL-td11290919.html#a11344350 > > based on the above, I still don't understand fully that: > > entity.getContent() will start downloading the content/body since > httpclient-3.x above or as soon as I call httpclient.execute(..) it will > download the whole response including the body. > > I'm using Httpclient-4.0.1, and what I have so far is I do a HEAD call, and > check content length if its not too large, then proceed a GET call, and do > something with the body from entity.getContent() which is very expensive. > > Could anyone please explain and point out to a better solution as I want to > avoid an extra call (i.e. say just do GET call)? > > Thanks.
Just do one GET, look at the content-length value if known, read as much (or as little) data as needed and then abort the request. It is often cheaper to close non-SSL connections than re-use them. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
