This discussion is archived
1 Reply Latest reply: Feb 16, 2007 4:18 PM by EJP RSS

Read from a HTTPS url

807597 Newbie
Currently Being Moderated
I'm new to HTTPS and SSL implementation, so my question may seem very basic to you all.

I'm trying to read from an HTTPS url. I can successfully read a standard HTTP url. I've read a lot of the posts, but I can't seem to get a handle on how to do this. We are not concerned about verifying certificates either on the server or client, as we are just using HTTPS to encrypt the connection and nothing else.

Could someone please send me the code, etc that I would need in order to do this? I'd greatly appreciate any help you can give me, and I'll be happy to reward you with Duke dollars! (I'm also an expert Swing developer so I can help you that way as well :)

Thanks!
  • 1. Re: Read from a HTTPS url
    EJP Guru
    Currently Being Moderated
    URL httpsURL = new URL("https://yourhost:yourport/yourpath/...");
    In other words it's the same as before just with https: in the protocol.

    Ignore any suggestion you see here or elsewhere about setting protocol handler packages or providers unless you are using Java 1.3 or 1.2.

    But:

    the server has to have a valid certificate in its keystore that is trusted by the client's truststore, and this can get complicated: you may have to export from the server's keystore, import to the client's truststore, and set the SSL truststore properties - see the Javadoc/Guide to Features/Security/JSSE Reference Guide. There are also programmatic ways to do all that but they're unnecessary 99% of the time,