dcsimg
https settings
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   arch_chap
Posted On:   Friday, November 23, 2001 03:19 AM

I have written a simple java class which access any site which is specified in the url.Contents of that page are copied in temporary html file. This code works fine for accessing sites starting from http. jdk1.2.2 is installed on the machine along with jsdk2.0. The steps followed for running the application is as follows 1. start the servletrunner from jsdk2.0/bin 2. And then run aprogram which call URL to open in the browser. But if I try to access any site starting from 'https', then it gives me error saying failed to open the site. What may be the reason?Can somebody help me getting the answer? The code written in the class is as follows UR   More>>

I have written a simple java class which access any site which is specified in the
url.Contents of that page are copied in temporary html file.
This code works fine for accessing sites starting from http.
jdk1.2.2 is installed on the machine along with jsdk2.0.
The steps followed for running the application is as follows
1. start the servletrunner from jsdk2.0/bin
2. And then run aprogram which call URL to open in the browser.

But if I try to access any site starting from 'https', then it gives me error
saying failed to open the site.
What may be the reason?Can somebody help me getting the answer?

The code written in the class is as follows

			
URL url = null;
url = new URL(strURL);
urlconnection = url.openConnection();
urlconnection.setDoInput(true);
urlconnection.setUseCaches(false);

BufferedInputStream bufferedinputstream = new BufferedInputStream(urlconnection.getInputStream());
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(new FileOutputStream(strDir + "" + strFileName));
int i;

while((i = bufferedinputstream.read()) >= 0)
{
bufferedoutputstream.write(i);
}
bufferedinputstream.close();
bufferedoutputstream.flush();
bufferedoutputstream.close();




For https I am getting error at bufferedInputStream function


Thanks in Advance

   <<Less

Re: https settings

Posted By:   Eugene_Kuleshov  
Posted On:   Friday, November 23, 2001 04:21 AM

Add the following code at the beginning (because you are wrinting to stream)

urlconnection.setDoOutput(true);
About | Sitemap | Contact