Here you can find the source of getHttpUrlConnection(String urlStr)
Parameter | Description |
---|
public static HttpURLConnection getHttpUrlConnection(String urlStr)
//package com.java2s; import java.net.HttpURLConnection; import java.net.Proxy; import java.net.URL; public class Main { private static Proxy proxy; /**/*ww w . java2 s .c o m*/ * Return URL object by given URL string, proxy is considered * @param urlStr: string of URL link * @return URL object */ public static HttpURLConnection getHttpUrlConnection(String urlStr) { HttpURLConnection conn = null; try { URL url = new URL(urlStr); if (proxy != null) { conn = (HttpURLConnection) url.openConnection(proxy); } else { conn = (HttpURLConnection) url.openConnection(); } } catch (Exception e) { return null; } return conn; } }