Example usage for org.apache.commons.httpclient ProxyHost toString

List of usage examples for org.apache.commons.httpclient ProxyHost toString

Introduction

In this page you can find the example usage for org.apache.commons.httpclient ProxyHost toString.

Prototype

public String toString() 

Source Link

Usage

From source file:org.alfresco.repo.remoteconnector.RemoteConnectorServiceImpl.java

/**
 * Create proxy host for the given system host and port properties.
 * If the properties are not set, no proxy will be created.
 * /*from www  . j ava  2  s .c  o  m*/
 * @param hostProperty String
 * @param portProperty String
 * @param defaultPort int
 * 
 * @return ProxyHost if appropriate properties have been set, null otherwise
 */
private static ProxyHost createProxyHost(final String hostProperty, final String portProperty,
        final int defaultPort) {
    final String proxyHost = System.getProperty(hostProperty);
    ProxyHost proxy = null;
    if (proxyHost != null && proxyHost.length() != 0) {
        final String strProxyPort = System.getProperty(portProperty);
        if (strProxyPort == null || strProxyPort.length() == 0) {
            proxy = new ProxyHost(proxyHost, defaultPort);
        } else {
            proxy = new ProxyHost(proxyHost, Integer.parseInt(strProxyPort));
        }
        if (logger.isDebugEnabled())
            logger.debug("ProxyHost: " + proxy.toString());
    }
    return proxy;
}