You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Saifadam Pathan <sp...@controlnet.co.in> on 2004/03/11 10:54:33 UTC

Downloading Images

Hi ...

How do i do the following...

I have specified the url as  a link to an image, ( example : url =3D =
"http://www.google.co.in/images/hp0.gif" ). And then I am calling the =
following...

HttpMethod method =3D new GetMethod(url);
statusCode =3D client.executeMethod(method);
.....

.....

**************************************


Is this the right way. How do i store this image?

Thanks in advance.=20

Saif


Re: Downloading Images

Posted by Roland Weber <RO...@de.ibm.com>.
Except for error handling and stuff, this is the right approach.
To store the image, you have to create a FileOutputStream
and copy the response data there. See also the section
"Read the Response" in the tutorial:
http://jakarta.apache.org/commons/httpclient/tutorial.html

cheers,
  Roland






"Saifadam Pathan" <sp...@controlnet.co.in>
11.03.2004 10:54
Please respond to "Commons HttpClient Project"
 
        To:     "Commons HttpClient Project" 
<co...@jakarta.apache.org>
        cc: 
        Subject:        Downloading Images


Hi ...

How do i do the following...

I have specified the url as  a link to an image, ( example : url =3D =
"http://www.google.co.in/images/hp0.gif" ). And then I am calling the =
following...

HttpMethod method =3D new GetMethod(url);
statusCode =3D client.executeMethod(method);
.....

.....

**************************************


Is this the right way. How do i store this image?

Thanks in advance.=20

Saif---------------------------------------------------------------------
To unsubscribe, e-mail: 
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: 
commons-httpclient-dev-help@jakarta.apache.org