hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ossf...@dubioso.net>
Subject Re: How to download file with HttpClient ?
Date Fri, 21 Dec 2007 05:38:59 GMT
nitya vyas wrote:
> i m sure he meant "Any" .. not "ant" .... :)

Oh, right. On american keyboards, those two are next to eachother.
Thanks for reminding me :-)

>>> How can I download a file with HttpClient? Ant example please?
>> Are you kidding? HttpClient is a Java API, not an Ant task.
>> Read the tutorial.
>> http://hc.apache.org/httpclient-3.x/tutorial.html

The tutorial explains how to get the data from the server.
The section "Read the Response" uses a method that is not
exactly recommended and may give you a warning in the logs.
The recommended way is to use method.getResponseBodyAsStream()
and then read the data from the stream block by block. If
you need help in writing it to a file, check the Java Tutorial:
http://java.sun.com/docs/books/tutorial/essential/io/index.html

hope that helps,
  Roland





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


Mime
View raw message