Hi,
I am writing a java program that reads the content from a secured site.
It is successfully able to open a URL connection but is not able to read the content type and the length and gives the following exception -
Computed URL is
https://www.google.com Content-type = null
Content-length = -1
javax.net.ssl.SSLException: error while writing to socket
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(OutputStream.java:58)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:1082)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:663)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:1122)
at java.net.URLConnection.getContentType(URLConnection.java:381)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getContentType(DashoA6275)
at UseHttps.main(UseHttps.java:80)
Code snippet -
Any idea as to what is going wrong?
thanks,
Snigdha