org.apache.commons.httpclient.HttpHost.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.apache.commons.httpclient.HttpHost.<init>()方法的一些代码示例,展示了HttpHost.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpHost.<init>()方法的具体详情如下:
包路径:org.apache.commons.httpclient.HttpHost
类名称:HttpHost
方法名:<init>

HttpHost.<init>介绍

[英]Constructor for HttpHost.
[中]HttpHost的构造函数。

代码示例

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Sets the given host, port and protocol.
 *   
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol the protocol
 */
public synchronized void setHost(final String host, int port, final Protocol protocol) {
  if (host == null) {
    throw new IllegalArgumentException("host must not be null");   
  }
  if (protocol == null) {
    throw new IllegalArgumentException("protocol must not be null");   
  }
  this.host = new HttpHost(host, port, protocol);
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Sets the given host, port and protocol
 * 
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol The protocol.
 */
public synchronized void setHost(final String host, int port, final String protocol) {
  this.host = new HttpHost(host, port, Protocol.getProtocol(protocol));
}

代码示例来源:origin: elastic/elasticsearch-hadoop

public synchronized void setHost(String host, int port, String scheme) {
  setHost(new HttpHost(host, port, keepProtocol(host, port, scheme)));
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Sets the {@link HostConfiguration host configuration}.
 * 
 * @param hostconfig The hostConfiguration to set
 * 
 * @deprecated no longer applicable
 */
public void setHostConfiguration(final HostConfiguration hostconfig) {
  if (hostconfig != null) {
    this.httphost = new HttpHost(
        hostconfig.getHost(),
        hostconfig.getPort(),
        hostconfig.getProtocol());
  } else {
    this.httphost = null;
  }
}

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * Sets the URI for this method. 
 * 
 * @param uri URI to be set 
 * 
 * @throws URIException if a URI cannot be set
 * 
 * @since 3.0
 */
public void setURI(URI uri) throws URIException {
  // only set the host if specified by the URI
  if (uri.isAbsoluteURI()) {
    this.httphost = new HttpHost(uri);
  }
  // set the path, defaulting to root
  setPath(
    uri.getPath() == null
    ? "/"
    : uri.getEscapedPath()
  );
  setQueryString(uri.getEscapedQuery());
}

代码示例来源:origin: org.apache.commons/httpclient

/**
 * Sets the given host, port and protocol.
 *   
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol the protocol
 */
public synchronized void setHost(final String host, int port, final Protocol protocol) {
  if (host == null) {
    throw new IllegalArgumentException("host must not be null");   
  }
  if (protocol == null) {
    throw new IllegalArgumentException("protocol must not be null");   
  }
  this.host = new HttpHost(host, port, protocol);
}

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Sets the given host, port and protocol.
 *   
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol the protocol
 */
public synchronized void setHost(final String host, int port, final Protocol protocol) {
  if (host == null) {
    throw new IllegalArgumentException("host must not be null");   
  }
  if (protocol == null) {
    throw new IllegalArgumentException("protocol must not be null");   
  }
  this.host = new HttpHost(host, port, protocol);
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Sets the given host, port and protocol.
 *   
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol the protocol
 */
public synchronized void setHost(final String host, int port, final Protocol protocol) {
  if (host == null) {
    throw new IllegalArgumentException("host must not be null");   
  }
  if (protocol == null) {
    throw new IllegalArgumentException("protocol must not be null");   
  }
  this.host = new HttpHost(host, port, protocol);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Sets the given host, port and protocol.
 *   
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol the protocol
 */
public synchronized void setHost(final String host, int port, final Protocol protocol) {
  if (host == null) {
    throw new IllegalArgumentException("host must not be null");   
  }
  if (protocol == null) {
    throw new IllegalArgumentException("protocol must not be null");   
  }
  this.host = new HttpHost(host, port, protocol);
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * Sets the given host, port and protocol
 * 
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol The protocol.
 */
public synchronized void setHost(final String host, int port, final String protocol) {
  this.host = new HttpHost(host, port, Protocol.getProtocol(protocol));
}

代码示例来源:origin: org.apache.commons/httpclient

/**
 * Sets the given host, port and protocol
 * 
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol The protocol.
 */
public synchronized void setHost(final String host, int port, final String protocol) {
  this.host = new HttpHost(host, port, Protocol.getProtocol(protocol));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * Sets the given host, port and protocol
 * 
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol The protocol.
 */
public synchronized void setHost(final String host, int port, final String protocol) {
  this.host = new HttpHost(host, port, Protocol.getProtocol(protocol));
}

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * Sets the given host, port and protocol
 * 
 * @param host the host(IP or DNS name)
 * @param port The port
 * @param protocol The protocol.
 */
public synchronized void setHost(final String host, int port, final String protocol) {
  this.host = new HttpHost(host, port, Protocol.getProtocol(protocol));
}

代码示例来源:origin: org.elasticsearch/elasticsearch-spark-13

public synchronized void setHost(String host, int port, String scheme) {
  setHost(new HttpHost(host, port, keepProtocol(host, port, scheme)));
}

代码示例来源:origin: org.elasticsearch/elasticsearch-spark

public synchronized void setHost(String host, int port, String scheme) {
  setHost(new HttpHost(host, port, keepProtocol(host, port, scheme)));
}

代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop

public synchronized void setHost(String host, int port, String scheme) {
  setHost(new HttpHost(host, port, keepProtocol(host, port, scheme)));
}

代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop-mr

public synchronized void setHost(String host, int port, String scheme) {
  setHost(new HttpHost(host, port, keepProtocol(host, port, scheme)));
}

代码示例来源:origin: org.zaproxy/zap

@Override
  public synchronized void setHost(URI uri) {
    try {
      setHost(new HttpHost(uri.getHost(), uri.getPort(), getProtocol()));
    } catch (URIException e) {
      throw new IllegalArgumentException(e.toString());
    }
  };
};

代码示例来源:origin: org.mule.transports/mule-transport-http

@Override
public synchronized void setHost(HttpHost host)
{
  Protocol newProtocol = cloneProtocolKeepingSocketFactory(host.getProtocol());
  
  HttpHost hostCopy = new HttpHost(host.getHostName(), host.getPort(), newProtocol);
  super.setHost(hostCopy);
}

代码示例来源:origin: smartrics/RestFixture

@SuppressWarnings("deprecation")
public void setURI(org.apache.commons.httpclient.HttpMethodBase m, URI uri)
    throws URIException {
  HostConfiguration conf = m.getHostConfiguration();
  if (uri.isAbsoluteURI()) {
    conf.setHost(new HttpHost(uri));
    m.setHostConfiguration(conf);
  }
  m.setPath(uri.getPath() != null ? uri.getEscapedPath() : "/");
  m.setQueryString(uri.getQuery());
}

相关文章