hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Download a .zip through https
Date Fri, 26 Oct 2007 10:22:46 GMT

On Thu, 2007-10-25 at 19:23 +0200, Tatiana Lloret Iglesias wrote:
> Hi all,
> 
> in my jsp i have a link which is linked with a .zip under https.
> 
> When i click on the link i should have the possibility of opening that .zip
> to save it locally
> 
> I have the following source code which works but i don't know what to do
> with the InputStream in ....

Try reading from it.

Oleg


> Thanks!
> T
> 
> 
> HttpClient client = new HttpClient();
> 
> HostConfiguration host = client.getHostConfiguration();
> host.setHost(new URI("https://www.host.com", true));
> 
> client.getState().setCredentials(
> new AuthScope(host.getHost(), 443,AuthScope.ANY_REALM),
> new UsernamePasswordCredentials("xxxx", "ddddd")
> );
> 
> get = new GetMethod("https://www.host.com/dd/ss/ee.zip");
> 
> get.setDoAuthentication( true );
> 
> // execute the GET
> int status = client.executeMethod( get );
> 
> //get the resonse as an InputStream
> InputStream in =
> get.getResponseBodyAsStream();


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


Mime
View raw message