Hi,
I am having difficulty reading from an https url. I can run my
servlet from the command line (main) and it works correctly. When I put it in WebSphere it gives:
java.net.MalformedURLException: unknown protocol: https
I have the 3 jars in the classpath. And I'm setting setProperty and addProvider.
Can anyone shed some light on this.
try{
// create a new protocol handler
System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
// protocol handler uses this security provider
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
URL url = new URL("https://www.somesite.com");
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
br.close();
}
catch(NoClassDefFoundError ncdfe){
System.out.println(ncdfe.toString());
}
catch(Exception ex){
System.out.println(ex.toString());
}
Thanks