HTTPS
In this chapter you will learn:
Dump a page using the HTTPS protocol
The following code creates a URL from https protocol. And then open connection from the HTTPS connection.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
//j ava 2s . co m
public class Main {
public static void main(String[] argv) throws Exception {
URL url = new URL("https://www.server.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » URL URI