java - How to read response from Https urls? -
I am using the following code to get response code from https based URL, but when I run a program So it just hangs cont
code:
import java.net.; Import javax.net.ssl; Import java.io * *; Square Https2 {public static zero main throws exception []] {url u = new url ("https: // myurl"); HttpsURLConnection hc = (HttpsURLConnection) u.openConnection (); Hc.setConnectTimeout (3000); Hc.setReadTimeout (5000); System.out.println ("Response Code:" + hc.getResponseCode ()); Hc.disconnect ();
I do not know what this helps, but I have never found much happiness with the classes of JDK and usually using the normal HTTP client API () Jakarta.
Comments
Post a Comment