I want to access a secure URL using HttpsURLConnection and am having trouble reading the content back.
I am using the trustmanager example given here and have added the following code to access the page content:
HttpsURLConnection urlc = (HttpsURLConnection) new URL( <url> ).openConnection();
BufferedReader readIn= new BufferedReader(new InputStreamReader(urlc.getInputStream()));
String eachLine;
String inputLine = "";
while ((eachLine = readIn.readLine()) != null) {
inputLine += eachLine;
}
The trouble is, I keep getting the error:
java.security.cert.CertificateException: No subject alternative names present
Any ideas why? Thanks
EDIT
I forgot to mention, I am doing this using Spring and trying to call a servlet from another class.