Home arrow static arrow Java Programming [Archive] - Https and Zip File
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Https and Zip File
5 Duke Stars available
This topic has 2 replies on 1 page.

Registered: 3/15/04
Https and Zip File  
Aug 3, 2004 12:09 PM

I am having a problem with reading (downloading) a zip file from https-URL connection.
the same code works fine with http + url connection.
the problem I have that the file gets created but It seems to be corrupted as I can not open it with WinZip.
Does anybody have an explanation or recommendation??
the code as follows:

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
String urlString=WebInformation.VendorProtocol+ WebInformation.VendorhostName+ ":"+ WebInformation.VendorPortNumber + References.VendorReceiver;
url = new URL (urlString);
urlConn = (HttpsURLConnection)url.openConnection();



String xmlLength= (String) new Integer(xmlMessage.length()).toString();
urlConn.setRequestProperty("Content-Length",xmlLength );
printout= new DataOutputStream(urlConn.getOutputStream());

// read and write the zip file to the hard disk.
BufferedInputStream rd = new BufferedInputStream(url.openStream());
FileOutputStream fOutputStream= new FileOutputStream(outFile);
int count; // number of bytes has been read

while ( (count = rd.read(data,0,BUFFER) ) != -1) {


Registered: 8/3/04
Re: Https and Zip File  
Aug 3, 2004 12:27 PM (reply 1 of 2)

Okay, taking a stab here, so don't flame me :).

The way I understand it, HTTPS is supposed to be secure. Duh, right? Well, unless you can work some kind of HTTPS encryption into your applet, it would seem to me like it couldn't go from an unsecure zone (HTTP) to secure (HTTPS) without some kind of key.

I've seen applets that run in HTTP and HTTPS and even ones that pass variables to each other, but not one that would yank secure data from HTTPS.

Registered: 3/15/04
Re: Https and Zip File  
Aug 3, 2004 3:26 PM (reply 2 of 2)

well this connection is an https to an https; downloading a file as a Response to an http Request message.
This topic has 2 replies on 1 page.