How to get source of html page from a https adress in java
I am trying to implement a download manager in java for rapidshare, I am using the rapidshare API.
The problem is that for example if you go to the following link it redirects to a https p开发者_运维技巧age, but then when I read the content it always return me null in the InputStream When I try to put a https link in the HttpURLConnection it always throws an exeptionjavax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
Use Apache Commons HTTPUtils . You can make a connection to HTTPS (thereby decrypting it) if you override the DefaultTrustManager class (to do nothing), create a new TrustManager with it, then bypass the hostname verifier with ALLOW_ALL_HOSTNAME_VERIFIER. Since your opening the connection to a place that you trust, there isn't a problem bypassing these things.
精彩评论