| | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.InetSocketAddress; |
| | | import java.net.Proxy; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | |
| | | protected File download(String url, boolean verifyChecksum) throws IOException { |
| | | File file = downloadFile(url); |
| | | |
| | | if (!verifyChecksum) { |
| | | return file; |
| | | } |
| | | |
| | | File sha1File = null; |
| | | try { |
| | | sha1File = downloadFile(url + ".sha1"); |
| | |
| | | |
| | | } |
| | | |
| | | if (sha1File == null && md5File == null && verifyChecksum) { |
| | | if (sha1File == null && md5File == null) { |
| | | throw new IOException("Missing SHA1 and MD5 checksums for " + url); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | protected Proxy getProxy(URL url) { |
| | | return java.net.Proxy.NO_PROXY; |
| | | String proxyHost = runtimeManager.getSettings().getString(Keys.plugins.httpProxyHost, ""); |
| | | String proxyPort = runtimeManager.getSettings().getString(Keys.plugins.httpProxyPort, ""); |
| | | |
| | | if (!StringUtils.isEmpty(proxyHost) && !StringUtils.isEmpty(proxyPort)) { |
| | | return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, Integer.parseInt(proxyPort))); |
| | | } else { |
| | | return java.net.Proxy.NO_PROXY; |
| | | } |
| | | } |
| | | |
| | | protected String getProxyAuthorization(URL url) { |
| | | return ""; |
| | | String proxyAuth = runtimeManager.getSettings().getString(Keys.plugins.httpProxyAuthorization, ""); |
| | | return proxyAuth; |
| | | } |
| | | |
| | | /** |