Examples of TransportClientProperties


Examples of org.apache.axis.components.net.TransportClientProperties

     *
     * @throws Exception
     */
    private HttpConnection getSecureConnection(
            HttpState state, String host, int port) throws Exception {
        TransportClientProperties tcp = TransportClientPropertiesFactory.create("https");

        if (port == -1) {
            port = 443;
        }

        boolean hostInNonProxyList =
                isHostInNonProxyList(host, tcp.getNonProxyHosts());

        if (tcp.getProxyHost().length() == 0 || hostInNonProxyList) {
            return new HttpConnection(host, port, true);
        } else {

            // Default proxy port is 80, even for https
            int tunnelPort = ((tcp.getProxyPort().length() != 0)
                              ? Integer.parseInt(tcp.getProxyPort())
                              : 80);

            if (tunnelPort < 0)
                tunnelPort = 80;
               
            if (tcp.getProxyUser().length() != 0) {
                Credentials proxyCred =
                        new UsernamePasswordCredentials(tcp.getProxyUser(),
                                                        tcp.getProxyPassword());

                state.setProxyCredentials(null, proxyCred);
            }

            return new HttpConnection(tcp.getProxyHost(), tunnelPort, host, port, true);
        }
    }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

     *
     * @throws Exception
     */
    private HttpConnection getConnection(HttpState state, String host, int port)
            throws Exception {
        TransportClientProperties tcp = TransportClientPropertiesFactory.create("http");

        boolean hostInNonProxyList =
                isHostInNonProxyList(host, tcp.getNonProxyHosts());

        if (port == -1) {
            port = 80;
        }
        if (tcp.getProxyHost().length() == 0 ||
            tcp.getProxyPort().length() == 0 ||
            hostInNonProxyList) {
            return new HttpConnection(host, port);
        } else {
            if (tcp.getProxyUser().length() != 0) {
                Credentials proxyCred =
                        new UsernamePasswordCredentials(tcp.getProxyUser(),
                                                        tcp.getProxyPassword());

                state.setProxyCredentials(null, proxyCred);
            }
            return new HttpConnection(tcp.getProxyHost(),
                                      new Integer(tcp.getProxyPort()).intValue(), host,
                                      port);
        }
    }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

    MessageContext context,
    URL targetURL,
    ProtocolFactory myFactory) {


    TransportClientProperties tcp =
      TransportClientPropertiesFactory.create(targetURL.getProtocol()); // http or https
    int port = targetURL.getPort();
    boolean hostInNonProxyList =
      isHostInNonProxyList(targetURL.getHost(), tcp.getNonProxyHosts());

    HostConfiguration config = new HostConfiguration();

    if (port == -1) {
      if(targetURL.getProtocol().equalsIgnoreCase("https")) {
        port = 443;             // default port for https being 443
      } else {
        // it must be http
        port = 80;              // default port for http being 80
      }
    }

    if(hostInNonProxyList){
      if (myFactory != null)
        config.setHost(targetURL.getHost(), port, myFactory.getProtocol(targetURL.getProtocol()));
      else
        config.setHost(targetURL.getHost(), port, Protocol.getProtocol(targetURL.getProtocol()));
    } else {
      if (tcp.getProxyHost().length() == 0 ||
        tcp.getProxyPort().length() == 0) {
        if (myFactory != null)
          config.setHost(targetURL.getHost(), port, myFactory.getProtocol(targetURL.getProtocol()));
        else
          config.setHost(targetURL.getHost(), port, Protocol.getProtocol(targetURL.getProtocol()));
      } else {
        if (tcp.getProxyUser().length() != 0) {
          Credentials proxyCred =
            new UsernamePasswordCredentials(tcp.getProxyUser(),
            tcp.getProxyPassword());
          // if the username is in the form "user\domain"
          // then use NTCredentials instead.
          int domainIndex = tcp.getProxyUser().indexOf("\\");
          if (domainIndex > 0) {
            String domain = tcp.getProxyUser().substring(0, domainIndex);
            if (tcp.getProxyUser().length() > domainIndex + 1) {
              String user = tcp.getProxyUser().substring(domainIndex + 1);
              proxyCred = new NTCredentials(user,
                tcp.getProxyPassword(),
                tcp.getProxyHost(), domain);
            }
          }
          client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
        }
        int proxyPort = new Integer(tcp.getProxyPort()).intValue();
        config.setProxy(tcp.getProxyHost(), proxyPort);
      }
    }
    return config;
  }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

        }
        return cookie;
    }
   
    private HostConfiguration getHostConfiguration(HttpClient client, URL targetURL) {
        TransportClientProperties tcp = TransportClientPropertiesFactory.create(targetURL.getProtocol()); // http or https
        int port = targetURL.getPort();
        boolean hostInNonProxyList =
        isHostInNonProxyList(targetURL.getHost(), tcp.getNonProxyHosts());
       
        HostConfiguration config = new HostConfiguration();
       
        if (port == -1) {
            port = 80;          // even for https
        }
        if (tcp.getProxyHost().length() == 0 ||
        tcp.getProxyPort().length() == 0 ||
        hostInNonProxyList) {
            config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
        } else {
            if (tcp.getProxyUser().length() != 0) {
                Credentials proxyCred =
                new UsernamePasswordCredentials(tcp.getProxyUser(),
                tcp.getProxyPassword());
                client.getState().setProxyCredentials(null, null, proxyCred);
            }
            int proxyPort = new Integer(tcp.getProxyPort()).intValue();
            config.setProxy(tcp.getProxyHost(), proxyPort);
        }
        return config;
    }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

     *
     * @throws Exception
     */
    private HttpConnection getSecureConnection(
            HttpState state, String host, int port) throws Exception {
        TransportClientProperties tcp = TransportClientPropertiesFactory.create("https");

        if (port == -1) {
            port = 443;
        }

        boolean hostInNonProxyList =
                isHostInNonProxyList(host, tcp.getNonProxyHosts());

        if (tcp.getProxyHost().length() == 0 || hostInNonProxyList) {
            return new HttpConnection(host, port, true);
        } else {

            // Default proxy port is 80, even for https
            int tunnelPort = ((tcp.getProxyPort().length() != 0)
                              ? Integer.parseInt(tcp.getProxyPort())
                              : 80);

            if (tunnelPort < 0)
                tunnelPort = 80;
               
            if (tcp.getProxyUser().length() != 0) {
                Credentials proxyCred =
                        new UsernamePasswordCredentials(tcp.getProxyUser(),
                                                        tcp.getProxyPassword());

                state.setProxyCredentials(null, proxyCred);
            }

            return new HttpConnection(tcp.getProxyHost(), tunnelPort, host, port, true);
        }
    }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

     *
     * @throws Exception
     */
    private HttpConnection getConnection(HttpState state, String host, int port)
            throws Exception {
        TransportClientProperties tcp = TransportClientPropertiesFactory.create("http");

        boolean hostInNonProxyList =
                isHostInNonProxyList(host, tcp.getNonProxyHosts());

        if (port == -1) {
            port = 80;
        }
        if (tcp.getProxyHost().length() == 0 ||
            tcp.getProxyPort().length() == 0 ||
            hostInNonProxyList) {
            return new HttpConnection(host, port);
        } else {
            if (tcp.getProxyUser().length() != 0) {
                Credentials proxyCred =
                        new UsernamePasswordCredentials(tcp.getProxyUser(),
                                                        tcp.getProxyPassword());

                state.setProxyCredentials(null, proxyCred);
            }
            return new HttpConnection(tcp.getProxyHost(),
                                      new Integer(tcp.getProxyPort()).intValue(), host,
                                      port);
        }
    }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

    MessageContext context,
    URL targetURL,
    ProtocolFactory myFactory) {


    TransportClientProperties tcp =
      TransportClientPropertiesFactory.create(targetURL.getProtocol()); // http or https
    int port = targetURL.getPort();
    boolean hostInNonProxyList =
      isHostInNonProxyList(targetURL.getHost(), tcp.getNonProxyHosts());

    HostConfiguration config = new HostConfiguration();

    if (port == -1) {
      if(targetURL.getProtocol().equalsIgnoreCase("https")) {
        port = 443;             // default port for https being 443
      } else {
        // it must be http
        port = 80;              // default port for http being 80
      }
    }

    if(hostInNonProxyList){
      if (myFactory != null)
        config.setHost(targetURL.getHost(), port, myFactory.getProtocol(targetURL.getProtocol()));
      else
        config.setHost(targetURL.getHost(), port, Protocol.getProtocol(targetURL.getProtocol()));
    } else {
      if (tcp.getProxyHost().length() == 0 ||
        tcp.getProxyPort().length() == 0) {
        if (myFactory != null)
          config.setHost(targetURL.getHost(), port, myFactory.getProtocol(targetURL.getProtocol()));
        else
          config.setHost(targetURL.getHost(), port, Protocol.getProtocol(targetURL.getProtocol()));
      } else {
        if (tcp.getProxyUser().length() != 0) {
          Credentials proxyCred =
            new UsernamePasswordCredentials(tcp.getProxyUser(),
            tcp.getProxyPassword());
          // if the username is in the form "user\domain"
          // then use NTCredentials instead.
          int domainIndex = tcp.getProxyUser().indexOf("\\");
          if (domainIndex > 0) {
            String domain = tcp.getProxyUser().substring(0, domainIndex);
            if (tcp.getProxyUser().length() > domainIndex + 1) {
              String user = tcp.getProxyUser().substring(domainIndex + 1);
              proxyCred = new NTCredentials(user,
                tcp.getProxyPassword(),
                tcp.getProxyHost(), domain);
            }
          }
          client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
        }
        int proxyPort = new Integer(tcp.getProxyPort()).intValue();
        config.setProxy(tcp.getProxyHost(), proxyPort);
      }
    }
    return config;
  }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

        }
        return cookie;
    }
   
    private HostConfiguration getHostConfiguration(HttpClient client, URL targetURL) {
        TransportClientProperties tcp = TransportClientPropertiesFactory.create(targetURL.getProtocol()); // http or https
        int port = targetURL.getPort();
        boolean hostInNonProxyList =
        isHostInNonProxyList(targetURL.getHost(), tcp.getNonProxyHosts());
       
        HostConfiguration config = new HostConfiguration();
       
        if (port == -1) {
            port = 80;          // even for https
        }
       
        if(hostInNonProxyList){
            config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
        } else {
            if (tcp.getProxyHost().length() == 0 ||
            tcp.getProxyPort().length() == 0) {
                config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
            } else {
                if (tcp.getProxyUser().length() != 0) {
                    Credentials proxyCred = new UsernamePasswordCredentials(tcp.getProxyUser(),
                                                tcp.getProxyPassword());
                    // if the username is in the form "user\domain"
                    // then use NTCredentials instead.
                    int domainIndex = tcp.getProxyUser().indexOf("\\");
                    if (domainIndex > 0) {
                        String domain = tcp.getProxyUser().substring(0, domainIndex);
                        if (tcp.getProxyUser().length() > domainIndex + 1) {
                            String user = tcp.getProxyUser().substring(domainIndex + 1);
                            proxyCred = new NTCredentials(user,
                                            tcp.getProxyPassword(),
                                            tcp.getProxyHost(), domain);
                        }
                    }                    
                    client.getState().setProxyCredentials(null, null, proxyCred);
                }
                int proxyPort = new Integer(tcp.getProxyPort()).intValue();
                config.setProxy(tcp.getProxyHost(), proxyPort);
            }
        }
        return config;
    }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

    }
   
    protected HostConfiguration getHostConfiguration(HttpClient client,
                                                     MessageContext context,
                                                     URL targetURL) {
        TransportClientProperties tcp =
            TransportClientPropertiesFactory.create(targetURL.getProtocol()); // http or https
        int port = targetURL.getPort();
        boolean hostInNonProxyList =
            isHostInNonProxyList(targetURL.getHost(), tcp.getNonProxyHosts());
       
        HostConfiguration config = new HostConfiguration();
       
        if (port == -1) {
            port = 80;          // even for https
        }
       
        if(hostInNonProxyList){
            config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
        } else {
            if (tcp.getProxyHost().length() == 0 ||
                tcp.getProxyPort().length() == 0) {
                config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
            } else {
                if (tcp.getProxyUser().length() != 0) {
                    Credentials proxyCred =
                        new UsernamePasswordCredentials(tcp.getProxyUser(),
                                                        tcp.getProxyPassword());
                    // if the username is in the form "user\domain"
                    // then use NTCredentials instead.
                    int domainIndex = tcp.getProxyUser().indexOf("\\");
                    if (domainIndex > 0) {
                        String domain = tcp.getProxyUser().substring(0, domainIndex);
                        if (tcp.getProxyUser().length() > domainIndex + 1) {
                            String user = tcp.getProxyUser().substring(domainIndex + 1);
                            proxyCred = new NTCredentials(user,
                                            tcp.getProxyPassword(),
                                            tcp.getProxyHost(), domain);
                        }
                    }
                    client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
                }
                int proxyPort = new Integer(tcp.getProxyPort()).intValue();
                config.setProxy(tcp.getProxyHost(), proxyPort);
            }
        }
        return config;
    }
View Full Code Here

Examples of org.apache.axis.components.net.TransportClientProperties

     *
     * @throws Exception
     */
    private HttpConnection getSecureConnection(
            HttpState state, String host, int port) throws Exception {
        TransportClientProperties tcp = TransportClientPropertiesFactory.create("https");

        if (port == -1) {
            port = 443;
        }

        boolean hostInNonProxyList =
                isHostInNonProxyList(host, tcp.getNonProxyHosts());

        if (tcp.getProxyHost().length() == 0 || hostInNonProxyList) {
            return new HttpConnection(host, port, true);
        } else {

            // Default proxy port is 80, even for https
            int tunnelPort = ((tcp.getProxyPort().length() != 0)
                              ? Integer.parseInt(tcp.getProxyPort())
                              : 80);

            if (tunnelPort < 0)
                tunnelPort = 80;
               
            if (tcp.getProxyUser().length() != 0) {
                Credentials proxyCred =
                        new UsernamePasswordCredentials(tcp.getProxyUser(),
                                                        tcp.getProxyPassword());

                state.setProxyCredentials(null, proxyCred);
            }

            return new HttpConnection(tcp.getProxyHost(), tunnelPort, host, port, true);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.