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 Eric Chow <er...@gmail.com> on 2007/12/21 05:01:35 UTC
How to download file with HttpClient ?
Hello,
How can I download a file with HttpClient? Ant example please?
Best regards,
Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: How to download file with HttpClient ?
Posted by Roland Weber <os...@dubioso.net>.
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
Re: How to download file with HttpClient ?
Posted by Man Tat Lam <la...@gmail.com>.
http://www.catb.org/~esr/faqs/smart-questions.html
What is it that you are trying to download, a link from the page??
MT
On Dec 20, 2007 9:26 PM, nitya vyas <ni...@gmail.com> wrote:
> i m sure he meant "Any" .. not "ant" .... :)
>
> On Dec 21, 2007 9:45 AM, Roland Weber <os...@dubioso.net> wrote:
>
> > Eric Chow wrote:
> > >
> > > 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
> >
> > cheers,
> > Roland
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
>
Re: How to download file with HttpClient ?
Posted by nitya vyas <ni...@gmail.com>.
i m sure he meant "Any" .. not "ant" .... :)
On Dec 21, 2007 9:45 AM, Roland Weber <os...@dubioso.net> wrote:
> Eric Chow wrote:
> >
> > 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
>
> cheers,
> Roland
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
Re: How to download file with HttpClient ?
Posted by Roland Weber <os...@dubioso.net>.
Eric Chow wrote:
>
> 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
cheers,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org