get Https URL Connection - Java Network

Java examples for Network:Http

Description

get Https URL Connection

Demo Code


//package com.java2s;

import java.io.IOException;

import java.net.URL;

import javax.net.ssl.HttpsURLConnection;

public class Main {
    public static void main(String[] argv) throws Exception {
        String strUrl = "java2s.com";
        System.out.println(getHttpsURLConnection(strUrl));
    }/*w ww.j  a v a2 s  . c  om*/

    public static HttpsURLConnection getHttpsURLConnection(String strUrl)
            throws IOException {
        URL url = new URL(strUrl);
        HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url
                .openConnection();
        return httpsURLConnection;
    }
}

Related Tutorials