Package com.ning.http.client

Examples of com.ning.http.client.ProxyServer


        c.setRequestTimeoutInMs(config.getReadTimeout());
        c.setFollowRedirects(config.isFollowRedirects());

        // setup proxy
        if (config.getProxyHost() != null) {
            c.setProxyServer(new ProxyServer(config.getProxyHost(), config.getProxyPort()));
        }

        return new AsyncHttpClient(c.build());
    }
View Full Code Here


        if(entity != null) {
            builder = builder.setBody(entity);
        }

        ProxyServer proxyServer = createProxyServer(cr);
        if(proxyServer != null)
            builder.setProxyServer(proxyServer);

        if(this.clientConfig != null) {
            if(!this.clientConfig.getPropertyAsFeature(NonBlockingClientConfig.PROPERTY_DISABLE_COOKIES)) {
View Full Code Here

            this.protocol = protocol;
            return this;
        }

        public ProxyServer build() {
            return new ProxyServer(protocol, host, port, username, password);
        }
View Full Code Here

                proxyPortInt = Integer.parseInt(proxyPort);
            } catch (NumberFormatException e) {
                Logger.error("Cannot parse the proxy port property '%s'. Check property http.proxyPort either in System configuration or in Play config file.", proxyPort);
                throw new IllegalStateException("WS proxy is misconfigured -- check the logs for details");
            }
            ProxyServer proxy = new ProxyServer(proxyHost, proxyPortInt, proxyUser, proxyPassword);
            confBuilder.setProxyServer(proxy);
        }
        if (userAgent != null) {
            confBuilder.setUserAgent(userAgent);
        }
View Full Code Here

        c.setRequestTimeoutInMs(config.getReadTimeout());
        c.setFollowRedirects(config.isFollowRedirects());

        // setup proxy
        if (config.getProxyHost() != null) {
            c.setProxyServer(new ProxyServer(config.getProxyHost(), config.getProxyPort()));
        }

        return new AsyncHttpClient(c.build());
    }
View Full Code Here

                proxyPortInt = Integer.parseInt(proxyPort);
            } catch (NumberFormatException e) {
                Logger.error("Cannot parse the proxy port property '%s'. Check property http.proxyPort either in System configuration or in Play config file.", proxyPort);
                throw new IllegalStateException("WS proxy is misconfigured -- check the logs for details");
            }
            ProxyServer proxy = new ProxyServer(proxyHost, proxyPortInt, proxyUser, proxyPassword);
            confBuilder.setProxyServer(proxy);
        }
        if (userAgent != null) {
            confBuilder.setUserAgent(userAgent);
        }
View Full Code Here

                protocol = Protocol.valueOf(System.getProperty(PROXY_PROTOCOL, "HTTP"));
            } catch(IllegalArgumentException e) {
                protocol = Protocol.HTTP;
            }
           
            ProxyServer proxyServer = new ProxyServer(protocol, host, port, System.getProperty(PROXY_USER), System.getProperty(PROXY_PASSWORD));
           
            String nonProxyHosts = System.getProperties().getProperty(PROXY_NONPROXYHOSTS);
            if (nonProxyHosts != null) {
                for (String spec : nonProxyHosts.split("\\|")) {
                    proxyServer.addNonProxyHost(spec);
                }
            }
           
            return proxyServer;
        }
View Full Code Here

            method = new OptionsMethod(request.getUrl());
        } else {
            throw new IllegalStateException(String.format("Invalid Method", methodName));
        }

        ProxyServer proxyServer = request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
        boolean avoidProxy = ProxyUtils.avoidProxy( proxyServer, request );
        if (!avoidProxy) {

            if (proxyServer.getPrincipal() != null) {
                Credentials defaultcreds = new UsernamePasswordCredentials(proxyServer.getPrincipal(), proxyServer.getPassword());
                client.getState().setCredentials(new AuthScope(null, -1, AuthScope.ANY_REALM), defaultcreds);
            }

            ProxyHost proxyHost = proxyServer == null ? null : new ProxyHost(proxyServer.getHost(), proxyServer.getPort());
            client.getHostConfiguration().setProxyHost(proxyHost);
        }

        method.setFollowRedirects(false);
        if ((request.getCookies() != null) && !request.getCookies().isEmpty()) {
View Full Code Here

        if (config.getMaxTotalConnections() > -1 && (maxConnections.get() + 1) > config.getMaxTotalConnections()) {
            throw new IOException(String.format("Too many connections %s", config.getMaxTotalConnections()));
        }

        ProxyServer proxyServer = request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
        Realm realm =  request.getRealm() != null ?  request.getRealm() : config.getRealm();
        boolean avoidProxy = ProxyUtils.avoidProxy( proxyServer, request );
        Proxy proxy = null;
        if (!avoidProxy && (proxyServer != null || realm != null)) {
            try {
View Full Code Here

        return f;
    }

    private HttpURLConnection createUrlConnection(Request request) throws IOException {
        ProxyServer proxyServer = request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
        Realm realm =  request.getRealm() != null ?  request.getRealm() : config.getRealm();
        boolean avoidProxy = ProxyUtils.avoidProxy( proxyServer, request );
        Proxy proxy = null;
        if (!avoidProxy && proxyServer != null || realm != null) {
            try {
View Full Code Here

TOP

Related Classes of com.ning.http.client.ProxyServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.