/** * The behavior of this method is the same as openConnection(URL). * <code>proxy</code> is not used in FileURLConnection. * * @param url * the URL which the connection is pointing to * @param proxy * Proxy * @return a connection to the resource pointed by this url. * * @throws IOException * if this handler fails to establish a connection. * @throws IllegalArgumentException * if the url argument is null. * @throws UnsupportedOperationException * if the protocol handler doesn't support this method. */ @Override public URLConnection openConnection(URL url, Proxy proxy) throws IOException { if (url == null) { throw new IllegalArgumentException("url == null"); } String host = url.getHost(); if (host == null || host.isEmpty() || host.equalsIgnoreCase("localhost")) { return new FileURLConnection(url); } // If a hostname is specified try to get the resource using FTP URL ftpURL = new URL("ftp", host, url.getFile()); return (proxy == null) ? ftpURL.openConnection() : ftpURL.openConnection(proxy); }
/** * The behavior of this method is the same as openConnection(URL). * <code>proxy</code> is not used in FileURLConnection. * * @param url * the URL which the connection is pointing to * @param proxy * Proxy * @return a connection to the resource pointed by this url. * * @throws IOException * if this handler fails to establish a connection. * @throws IllegalArgumentException * if the url argument is null. * @throws UnsupportedOperationException * if the protocol handler doesn't support this method. */ @Override public URLConnection openConnection(URL url, Proxy proxy) throws IOException { if (url == null) { throw new IllegalArgumentException("url == null"); } String host = url.getHost(); if (host == null || host.isEmpty() || host.equalsIgnoreCase("localhost")) { return new FileURLConnection(url); } // If a hostname is specified try to get the resource using FTP URL ftpURL = new URL("ftp", host, url.getFile()); return (proxy == null) ? ftpURL.openConnection() : ftpURL.openConnection(proxy); }
/** * The behavior of this method is the same as openConnection(URL). * <code>proxy</code> is not used in FileURLConnection. * * @param url * the URL which the connection is pointing to * @param proxy * Proxy * @return a connection to the resource pointed by this url. * * @throws IOException * if this handler fails to establish a connection. * @throws IllegalArgumentException * if the url argument is null. * @throws UnsupportedOperationException * if the protocol handler doesn't support this method. */ @Override public URLConnection openConnection(URL url, Proxy proxy) throws IOException { if (url == null) { throw new IllegalArgumentException("url == null"); } String host = url.getHost(); if (host == null || host.isEmpty() || host.equalsIgnoreCase("localhost")) { return new FileURLConnection(url); } // If a hostname is specified try to get the resource using FTP URL ftpURL = new URL("ftp", host, url.getFile()); return (proxy == null) ? ftpURL.openConnection() : ftpURL.openConnection(proxy); }
/** * The behavior of this method is the same as openConnection(URL). * <code>proxy</code> is not used in FileURLConnection. * * @param url * the URL which the connection is pointing to * @param proxy * Proxy * @return a connection to the resource pointed by this url. * * @throws IOException * if this handler fails to establish a connection. * @throws IllegalArgumentException * if the url argument is null. * @throws UnsupportedOperationException * if the protocol handler doesn't support this method. */ @Override public URLConnection openConnection(URL url, Proxy proxy) throws IOException { if (url == null) { throw new IllegalArgumentException("url == null"); } String host = url.getHost(); if (host == null || host.isEmpty() || host.equalsIgnoreCase("localhost")) { return new FileURLConnection(url); } // If a hostname is specified try to get the resource using FTP URL ftpURL = new URL("ftp", host, url.getFile()); return (proxy == null) ? ftpURL.openConnection() : ftpURL.openConnection(proxy); }
/** * The behavior of this method is the same as openConnection(URL). * <code>proxy</code> is not used in FileURLConnection. * * @param url * the URL which the connection is pointing to * @param proxy * Proxy * @return a connection to the resource pointed by this url. * * @throws IOException * if this handler fails to establish a connection. * @throws IllegalArgumentException * if the url argument is null. * @throws UnsupportedOperationException * if the protocol handler doesn't support this method. */ @Override public URLConnection openConnection(URL url, Proxy proxy) throws IOException { if (url == null) { throw new IllegalArgumentException("url == null"); } String host = url.getHost(); if (host == null || host.isEmpty() || host.equalsIgnoreCase("localhost")) { return new FileURLConnection(url); } // If a hostname is specified try to get the resource using FTP URL ftpURL = new URL("ftp", host, url.getFile()); return (proxy == null) ? ftpURL.openConnection() : ftpURL.openConnection(proxy); }
/** * The behavior of this method is the same as openConnection(URL). * <code>proxy</code> is not used in FileURLConnection. * * @param url * the URL which the connection is pointing to * @param proxy * Proxy * @return a connection to the resource pointed by this url. * * @throws IOException * if this handler fails to establish a connection. * @throws IllegalArgumentException * if the url argument is null. * @throws UnsupportedOperationException * if the protocol handler doesn't support this method. */ @Override public URLConnection openConnection(URL url, Proxy proxy) throws IOException { if (url == null) { throw new IllegalArgumentException("url == null"); } String host = url.getHost(); if (host == null || host.isEmpty() || host.equalsIgnoreCase("localhost")) { return new FileURLConnection(url); } // If a hostname is specified try to get the resource using FTP URL ftpURL = new URL("ftp", host, url.getFile()); return (proxy == null) ? ftpURL.openConnection() : ftpURL.openConnection(proxy); }
/** * The behavior of this method is the same as openConnection(URL). * <code>proxy</code> is not used in FileURLConnection. * * @param url * the URL which the connection is pointing to * @param proxy * Proxy * @return a connection to the resource pointed by this url. * * @throws IOException * if this handler fails to establish a connection. * @throws IllegalArgumentException * if the url argument is null. * @throws UnsupportedOperationException * if the protocol handler doesn't support this method. */ @Override public URLConnection openConnection(URL url, Proxy proxy) throws IOException { if (url == null) { throw new IllegalArgumentException("url == null"); } String host = url.getHost(); if (host == null || host.isEmpty() || host.equalsIgnoreCase("localhost")) { return new FileURLConnection(url); } // If a hostname is specified try to get the resource using FTP URL ftpURL = new URL("ftp", host, url.getFile()); return (proxy == null) ? ftpURL.openConnection() : ftpURL.openConnection(proxy); }