/** * Construct a connection to the specified url. A cache of * HTTPConnections is used to maximize the reuse of these across * multiple HttpURLConnections. * * <BR>The default method is "GET". * * @param url the url of the request * @exception ProtocolNotSuppException if the protocol is not supported */ public HttpURLConnection(URL url) throws ProtocolNotSuppException, IOException { super(url); // first read proxy properties and set try { String hosts = System.getProperty("http.nonProxyHosts", ""); if (!hosts.equalsIgnoreCase(non_proxy_hosts)) { connections.clear(); non_proxy_hosts = hosts; String[] list = Util.splitProperty(hosts); for (int idx=0; idx<list.length; idx++) HTTPConnection.dontProxyFor(list[idx]); } } catch (ParseException pe) { throw new IOException(pe.toString()); } catch (SecurityException se) { } try { String host = System.getProperty("http.proxyHost", ""); int port = Integer.getInteger("http.proxyPort", -1).intValue(); if (!host.equalsIgnoreCase(proxy_host) || port != proxy_port) { connections.clear(); proxy_host = host; proxy_port = port; HTTPConnection.setProxyServer(host, port); } } catch (SecurityException se) { } // now setup stuff con = getConnection(url); method = "GET"; method_set = false; resource = url.getFile(); headers = default_headers; do_redir = getFollowRedirects(); output_stream = null; urlString = url.toString(); }