https - Using java class HttpsURLConnection -


I have a small code that basically makes an HTTP-client, that means it posts a request and Works with replies. As long as the HTTP is doing something well-timed for some reason, for some reason I still have to support HTTPS, what I'm doing to open a brief connection:

  url = New URL (server address); HTTPSURL connection httpsConn = (HttpsURLConnection) url.openConnection ();  

It fails, stating:

  sun.net .www.protocol.https.HttpsURLConnectionImpl com.sun.net.ssl I can not put it in HttpsURLConnection  

I think it's a bit trivial, but I can not find that I'm doing wrong in this ... it went away, and the code Looks OK - no?

Appreciate any thoughts!

Just place it or put it instead. Both provide ways to do the desired work as good.


Any side related to technical problem Comment: You should ever not explicitly import / use Sun Java SE specific class in your code they are undocumented classes and They are subject to the changes, which may be the reason for your code break when you upgrade to JVM. On the other hand, when you run it in a different brand JVM, your code may also break.

Update : Because you think you have imported it window> Preferences> Java> Appearance> Type Filter and Add com.sun * and Sun. * List In this way you will never import them in an accident.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -