jfrog / artifactory-client-java

Artifactory REST Client Java API bindings
Apache License 2.0
319 stars 153 forks source link

Cannot use web proxy to access Artifactory #190

Open zeenlym opened 6 years ago

zeenlym commented 6 years ago

Hey,

I am using artifactory client services 2.6.0 in my project in order to fetch data from Artifactory. My desktop is behind a corporate web proxy. I get a timeout every time I tried to fetch data. Looking for a solution I found in this repository the class ProxyClient.

But a get the following error while building :

ProxyConfig(java.lang.String,int,java.lang.String,java.lang.String,java.lang.String) has protected access in org.jfrog.artifactory.client.ProxyConfig

It seems that ProxyConfig contrustor is protected in 2.6.0 and public in 2.6.1.

When will you push version 2.6.1 on bintray ?

My code is :

        ArtifactoryClientBuilder builder = ArtifactoryClientBuilder.create();
        builder.setUrl(url)
                .setUsername(login)
                .setPassword(api_key);

        // Set proxy if needed
        List<Proxy> hostProxies =  ProxySelector.getDefault().select(new URI(url));
        Proxy hostProxy = hostProxies.get(0);
        if ( hostProxy.type() == Proxy.Type.HTTP ) {
            InetSocketAddress hostProxyAddr = (InetSocketAddress) hostProxy.address();
            String proxy_host = hostProxyAddr.getHostString();
            int proxy_port = hostProxyAddr.getPort();
            log.debug("Configuration du proxy web " + proxy_host + ":" + proxy_port);
            ProxyConfig proxy = new ProxyConfig(proxy_host, proxy_port, null, null, null);
            builder.setProxy(proxy);
        }
yahavi commented 6 years ago

@zeenlym, Thanks for reporting. 2.6.1 published today on Bintray: https://bintray.com/jfrog/artifactory-tools/artifactory-client-java/2.6.1