Java Code Examples for com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig#Proxy
The following examples show how to use
com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig#Proxy .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeliumBundleFactory.java From zeppelin with Apache License 2.0 | 6 votes |
private ProxyConfig getProxyConfig(boolean isSecure) { List<ProxyConfig.Proxy> proxies = new LinkedList<>(); String httpProxy = StringUtils.isBlank(System.getenv("http_proxy")) ? System.getenv("HTTP_PROXY") : System.getenv("http_proxy"); String httpsProxy = StringUtils.isBlank(System.getenv("https_proxy")) ? System.getenv("HTTPS_PROXY") : System.getenv("https_proxy"); try { if (isSecure && StringUtils.isNotBlank(httpsProxy)) proxies.add(generateProxy("secure", new URI(httpsProxy))); else if (!isSecure && StringUtils.isNotBlank(httpProxy)) proxies.add(generateProxy("insecure", new URI(httpProxy))); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } return new ProxyConfig(proxies); }
Example 2
Source File: HeliumBundleFactory.java From zeppelin with Apache License 2.0 | 6 votes |
private ProxyConfig.Proxy generateProxy(String proxyId, URI uri) { String protocol = uri.getScheme(); String host = uri.getHost(); int port = uri.getPort() <= 0 ? 80 : uri.getPort(); String username = null, password = null; if (uri.getUserInfo() != null) { String[] authority = uri.getUserInfo().split(":"); if (authority.length == 2) { username = authority[0]; password = authority[1]; } else if (authority.length == 1) { username = authority[0]; } } String nonProxyHosts = StringUtils.isBlank(System.getenv("no_proxy")) ? System.getenv("NO_PROXY") : System.getenv("no_proxy"); return new ProxyConfig.Proxy(proxyId, protocol, host, port, username, password, nonProxyHosts); }
Example 3
Source File: MojoUtils.java From frontend-maven-plugin with Apache License 2.0 | 6 votes |
static ProxyConfig getProxyConfig(MavenSession mavenSession, SettingsDecrypter decrypter) { if (mavenSession == null || mavenSession.getSettings() == null || mavenSession.getSettings().getProxies() == null || mavenSession.getSettings().getProxies().isEmpty()) { return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } else { final List<Proxy> mavenProxies = mavenSession.getSettings().getProxies(); final List<ProxyConfig.Proxy> proxies = new ArrayList<ProxyConfig.Proxy>(mavenProxies.size()); for (Proxy mavenProxy : mavenProxies) { if (mavenProxy.isActive()) { mavenProxy = decryptProxy(mavenProxy, decrypter); proxies.add(new ProxyConfig.Proxy(mavenProxy.getId(), mavenProxy.getProtocol(), mavenProxy.getHost(), mavenProxy.getPort(), mavenProxy.getUsername(), mavenProxy.getPassword(), mavenProxy.getNonProxyHosts())); } } LOGGER.info("Found proxies: {}", proxies); return new ProxyConfig(proxies); } }
Example 4
Source File: MojoUtils.java From wisdom with Apache License 2.0 | 6 votes |
public static ProxyConfig getProxyConfig(MavenSession mavenSession, SettingsDecrypter decrypter) { if (mavenSession == null || mavenSession.getSettings() == null || mavenSession.getSettings().getProxies() == null || mavenSession.getSettings().getProxies().isEmpty()) { return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList()); } else { final List<Proxy> mavenProxies = mavenSession.getSettings().getProxies(); final List<ProxyConfig.Proxy> proxies = new ArrayList<>(mavenProxies.size()); for (Proxy mavenProxy : mavenProxies) { if (mavenProxy.isActive()) { mavenProxy = decryptProxy(mavenProxy, decrypter); proxies.add(new ProxyConfig.Proxy(mavenProxy.getId(), mavenProxy.getProtocol(), mavenProxy.getHost(), mavenProxy.getPort(), mavenProxy.getUsername(), mavenProxy.getPassword(), mavenProxy.getNonProxyHosts())); } } return new ProxyConfig(proxies); } }