Java HttpURLConnection Create getHttpURLConnection(URL url)

Here you can find the source of getHttpURLConnection(URL url)

Description

get Http URL Connection

License

Open Source License

Declaration

public static HttpURLConnection getHttpURLConnection(URL url) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;

import java.net.HttpURLConnection;

import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.URL;

public class Main {
    private static Proxy proxy = null;

    public static HttpURLConnection getHttpURLConnection(String urlString)
            throws MalformedURLException, IOException {
        return getHttpURLConnection(new URL(urlString));
    }/* w ww . j av  a  2  s .  c o m*/

    public static HttpURLConnection getHttpURLConnection(URL url) throws IOException {
        if (proxy != null) {
            return (HttpURLConnection) url.openConnection(proxy);
        } else {
            return (HttpURLConnection) url.openConnection();
        }
    }
}

Related

  1. getHttpURLConnection(String strUrl)
  2. getHttpURLConnection(String uri, String soapAction, boolean soap12)
  3. getHttpUrlConnection(String url)
  4. getHttpURLConnection(String urlAsString)
  5. getHttpUrlConnection(String urlStr)
  6. getHttpUrlConnection(URL url)