Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.ProxyHost


        if (!urlString.startsWith("http://")) {
            urlString = "http://" + urlString;
        }
        try {
            URL url = new URL(urlString);
            ProxyHost hostInfo = PluginProxyUtil.detectProxy(url);
            if (hostInfo != null) {
                hostLabel.setText(hostInfo.getHostName());
                portLabel.setText(""+hostInfo.getPort());
            } else {
                hostLabel.setText("none");
                portLabel.setText("none");
            }
            grid.validate();
View Full Code Here


   
    public String getProxyHost(String urlString) {
        String result = urlString;
        try {
            URL url = new URL(urlString);
            ProxyHost hostInfo = PluginProxyUtil.detectProxy(url);
            if (hostInfo != null) {
                result = hostInfo.getHostName();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
View Full Code Here

           
            // Legacy: set the proxy server (if any)
            final String proxyHost = System.getProperty("http.proxyHost");
            if(proxyHost != null) {
                //TODO: support for http.nonProxyHosts e.g. -Dhttp.nonProxyHosts="*.devonline.gov.uk|*.devon.gov.uk"
                final ProxyHost proxy = new ProxyHost(proxyHost, Integer.parseInt(System.getProperty("http.proxyPort")));
                http.getHostConfiguration().setProxyHost(proxy);
            }

            //perform the request
            final int statusCode = http.executeMethod(method);
View Full Code Here

    cache = new File(etc, "cache");
   
    // Setup HTTP proxy
    String proxyHost = System.getProperty( "http.proxyHost");
        if (proxyHost != null && !proxyHost.equals("")) {
          ProxyHost proxy = new ProxyHost(proxyHost, Integer.parseInt(System.getProperty("http.proxyPort")));
            http.getHostConfiguration().setProxyHost(proxy);
        }
       
        // Detect OS open file command
        String os = System.getProperty("os.name").toLowerCase();
View Full Code Here

            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 (proxyHost != null && !"".equals(proxyHost.trim()))
        {
            ProxyHost proxyHostObject = (proxyPort == -1 ? new ProxyHost(proxyHost.trim()) : new ProxyHost(proxyHost.trim(), proxyPort));
            client.getHostConfiguration().setProxyHost(proxyHostObject);
        }
       
        // reuse existing state, if we have been here before
        Cookie[] cookies = (Cookie[])PortletMessaging.receive(request, HTTP_STATE);
View Full Code Here

        if (!urlString.startsWith("http://")) {
            urlString = "http://" + urlString;
        }
        try {
            URL url = new URL(urlString);
            ProxyHost hostInfo = PluginProxyUtil.detectProxy(url);
            if (hostInfo != null) {
                hostLabel.setText(hostInfo.getHostName());
                portLabel.setText(""+hostInfo.getPort());
            } else {
                hostLabel.setText("none");
                portLabel.setText("none");
            }
            grid.validate();
View Full Code Here

   
    public String getProxyHost(String urlString) {
        String result = urlString;
        try {
            URL url = new URL(urlString);
            ProxyHost hostInfo = PluginProxyUtil.detectProxy(url);
            if (hostInfo != null) {
                result = hostInfo.getHostName();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
View Full Code Here

    public int getProxyPort(String urlString) {
        int result = 80;
        try {
            URL url = new URL(urlString);
            ProxyHost hostInfo = PluginProxyUtil.detectProxy(url);
            if (hostInfo != null) {
                result = hostInfo.getPort();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
View Full Code Here

     */
    public static ProxyHost detectProxy(URL sampleURL)
        throws ProxyDetectionException
    {
       
        ProxyHost result = null;
        String javaVers = System.getProperty("java.runtime.version");
       
        if (LOG.isDebugEnabled()) {
            LOG.debug("About to attempt auto proxy detection under Java " +
                      "version:"+javaVers);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.ProxyHost

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.