use of com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig.Proxy in project frontend-maven-plugin by eirslett.
the class DefaultFileDownloader method execute.
private CloseableHttpResponse execute(String requestUrl, String userName, String password) throws IOException {
CloseableHttpResponse response;
Proxy proxy = proxyConfig.getProxyForUrl(requestUrl);
if (proxy != null) {
LOGGER.info("Downloading via proxy " + proxy.toString());
return executeViaProxy(proxy, requestUrl);
} else {
LOGGER.info("No proxy was configured, downloading directly");
if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(password)) {
LOGGER.info("Using credentials (" + userName + ") from settings.xml");
// Auth target host
URL aURL = new URL(requestUrl);
HttpClientContext localContext = makeLocalContext(aURL);
CredentialsProvider credentialsProvider = makeCredentialsProvider(aURL.getHost(), aURL.getPort(), userName, password);
response = buildHttpClient(credentialsProvider).execute(new HttpGet(requestUrl), localContext);
} else {
response = buildHttpClient(null).execute(new HttpGet(requestUrl));
}
}
return response;
}
use of com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig.Proxy in project frontend-maven-plugin by eirslett.
the class DefaultNpmRunner method buildArguments.
private static List<String> buildArguments(ProxyConfig proxyConfig, String npmRegistryURL) {
List<String> arguments = new ArrayList<String>();
if (npmRegistryURL != null && !npmRegistryURL.isEmpty()) {
arguments.add("--registry=" + npmRegistryURL);
}
if (!proxyConfig.isEmpty()) {
Proxy proxy = null;
if (npmRegistryURL != null && !npmRegistryURL.isEmpty()) {
proxy = proxyConfig.getProxyForUrl(npmRegistryURL);
}
if (proxy == null) {
proxy = proxyConfig.getSecureProxy();
}
if (proxy == null) {
proxy = proxyConfig.getInsecureProxy();
}
arguments.add("--https-proxy=" + proxy.getUri().toString());
arguments.add("--proxy=" + proxy.getUri().toString());
}
return arguments;
}
use of com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig.Proxy in project frontend-maven-plugin by eirslett.
the class DefaultYarnRunner method buildArguments.
private static List<String> buildArguments(ProxyConfig proxyConfig, String npmRegistryURL) {
List<String> arguments = new ArrayList<>();
if (npmRegistryURL != null && !npmRegistryURL.isEmpty()) {
arguments.add("--registry=" + npmRegistryURL);
}
if (!proxyConfig.isEmpty()) {
Proxy proxy = null;
if (npmRegistryURL != null && !npmRegistryURL.isEmpty()) {
proxy = proxyConfig.getProxyForUrl(npmRegistryURL);
}
if (proxy == null) {
proxy = proxyConfig.getSecureProxy();
}
if (proxy == null) {
proxy = proxyConfig.getInsecureProxy();
}
arguments.add("--https-proxy=" + proxy.getUri().toString());
arguments.add("--proxy=" + proxy.getUri().toString());
}
return arguments;
}
Aggregations