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

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

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

HttpHost.getPort介绍

[英]Returns the port.
[中]返回端口。

代码示例

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

/**
 * Returns the port.
 * 
 * @return the host port, or <code>-1</code> if not set
 * 
 * @see #isHostSet()
 */
public synchronized int getPort() {
  if (this.host != null) {
    return this.host.getPort();
  } else {
    return -1;
  }
}

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

/**
 * Returns the URI of the HTTP method
 * 
 * @return The URI
 * 
 * @throws URIException If the URI cannot be created.
 * 
 * @see org.apache.commons.httpclient.HttpMethod#getURI()
 */
public URI getURI() throws URIException {
  StringBuffer buffer = new StringBuffer();
  if (this.httphost != null) {
    buffer.append(this.httphost.getProtocol().getScheme());
    buffer.append("://");
    buffer.append(this.httphost.getHostName());
    int port = this.httphost.getPort();
    if (port != -1 && port != this.httphost.getProtocol().getDefaultPort()) {
      buffer.append(":");
      buffer.append(port);
    }
  }
  buffer.append(this.path);
  if (this.queryString != null) {
    buffer.append('?');
    buffer.append(this.queryString);
  }
  String charset = getParams().getUriCharset();
  return new URI(buffer.toString(), true, charset);
}

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

return false;
if (this.host.getPort() != connection.getPort()) {
  return false;

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

/**
 * Returns the port.
 * 
 * @return the host port, or <code>-1</code> if not set
 * 
 * @see #isHostSet()
 */
public synchronized int getPort() {
  if (this.host != null) {
    return this.host.getPort();
  } else {
    return -1;
  }
}

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

/**
 * Returns the port.
 * 
 * @return the host port, or <code>-1</code> if not set
 * 
 * @see #isHostSet()
 */
public synchronized int getPort() {
  if (this.host != null) {
    return this.host.getPort();
  } else {
    return -1;
  }
}

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

/**
 * Returns the port.
 * 
 * @return the host port, or <code>-1</code> if not set
 * 
 * @see #isHostSet()
 */
public synchronized int getPort() {
  if (this.host != null) {
    return this.host.getPort();
  } else {
    return -1;
  }
}

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

/**
 * Returns the port.
 * 
 * @return the host port, or <code>-1</code> if not set
 * 
 * @see #isHostSet()
 */
public synchronized int getPort() {
  if (this.host != null) {
    return this.host.getPort();
  } else {
    return -1;
  }
}

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

public URI getURI(String scheme, String host, int port, String path,
    String queryString, HttpMethodParams params) throws URIException {
  HttpHost httphost = new HttpHost(host, port);
  StringBuffer buffer = new StringBuffer();
  if (httphost != null) {
    buffer.append(httphost.getProtocol().getScheme());
    buffer.append("://");
    buffer.append(httphost.getHostName());
    int p = httphost.getPort();
    if (p != -1 && p != httphost.getProtocol().getDefaultPort()) {
      buffer.append(":");
      buffer.append(p);
    }
  }
  buffer.append(path);
  if (queryString != null) {
    buffer.append('?');
    buffer.append(queryString);
  }
  String charset = params.getUriCharset();
  return new HttpURL(buffer.toString(), charset);
}

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

/**
 * Returns the URI of the HTTP method
 * 
 * @return The URI
 * 
 * @throws URIException If the URI cannot be created.
 * 
 * @see org.apache.commons.httpclient.HttpMethod#getURI()
 */
public URI getURI() throws URIException {
  StringBuffer buffer = new StringBuffer();
  if (this.httphost != null) {
    buffer.append(this.httphost.getProtocol().getScheme());
    buffer.append("://");
    buffer.append(this.httphost.getHostName());
    int port = this.httphost.getPort();
    if (port != -1 && port != this.httphost.getProtocol().getDefaultPort()) {
      buffer.append(":");
      buffer.append(port);
    }
  }
  buffer.append(this.path);
  if (this.queryString != null) {
    buffer.append('?');
    buffer.append(this.queryString);
  }
  String charset = getParams().getUriCharset();
  return new URI(buffer.toString(), true, charset);
}

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

/**
 * Returns the URI of the HTTP method
 * 
 * @return The URI
 * 
 * @throws URIException If the URI cannot be created.
 * 
 * @see org.apache.commons.httpclient.HttpMethod#getURI()
 */
@Override
public URI getURI() throws URIException {
  StringBuffer buffer = new StringBuffer();
  if (this.httphost != null) {
    buffer.append(this.httphost.getProtocol().getScheme());
    buffer.append("://");
    buffer.append(this.httphost.getHostName());
    int port = this.httphost.getPort();
    if (port != -1 && port != this.httphost.getProtocol().getDefaultPort()) {
      buffer.append(":");
      buffer.append(port);
    }
  }
  buffer.append(this.path);
  if (this.queryString != null) {
    buffer.append('?');
    buffer.append(this.queryString);
  }
  String charset = getParams().getUriCharset();
  return new URI(buffer.toString(), true, charset);
}

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

/**
 * Returns the URI of the HTTP method
 * 
 * @return The URI
 * 
 * @throws URIException If the URI cannot be created.
 * 
 * @see org.apache.commons.httpclient.HttpMethod#getURI()
 */
public URI getURI() throws URIException {
  StringBuffer buffer = new StringBuffer();
  if (this.httphost != null) {
    buffer.append(this.httphost.getProtocol().getScheme());
    buffer.append("://");
    buffer.append(this.httphost.getHostName());
    int port = this.httphost.getPort();
    if (port != -1 && port != this.httphost.getProtocol().getDefaultPort()) {
      buffer.append(":");
      buffer.append(port);
    }
  }
  buffer.append(this.path);
  if (this.queryString != null) {
    buffer.append('?');
    buffer.append(this.queryString);
  }
  String charset = getParams().getUriCharset();
  return new URI(buffer.toString(), true, charset);
}

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

/**
 * Returns the URI of the HTTP method
 * 
 * @return The URI
 * 
 * @throws URIException If the URI cannot be created.
 * 
 * @see org.apache.commons.httpclient.HttpMethod#getURI()
 */
public URI getURI() throws URIException {
  StringBuffer buffer = new StringBuffer();
  if (this.httphost != null) {
    buffer.append(this.httphost.getProtocol().getScheme());
    buffer.append("://");
    buffer.append(this.httphost.getHostName());
    int port = this.httphost.getPort();
    if (port != -1 && port != this.httphost.getProtocol().getDefaultPort()) {
      buffer.append(":");
      buffer.append(port);
    }
  }
  buffer.append(this.path);
  if (this.queryString != null) {
    buffer.append('?');
    buffer.append(this.queryString);
  }
  String charset = getParams().getUriCharset();
  return new URI(buffer.toString(), true, charset);
}

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

/**
 * Returns the URI of the HTTP method
 * 
 * @return The URI
 * 
 * @throws URIException If the URI cannot be created.
 * 
 * @see org.apache.commons.httpclient.HttpMethod#getURI()
 */
public URI getURI() throws URIException {
  StringBuffer buffer = new StringBuffer();
  if (this.httphost != null) {
    buffer.append(this.httphost.getProtocol().getScheme());
    buffer.append("://");
    buffer.append(this.httphost.getHostName());
    int port = this.httphost.getPort();
    if (port != -1 && port != this.httphost.getProtocol().getDefaultPort()) {
      buffer.append(":");
      buffer.append(port);
    }
  }
  buffer.append(this.path);
  if (this.queryString != null) {
    buffer.append('?');
    buffer.append(this.queryString);
  }
  String charset = getParams().getUriCharset();
  return new URI(buffer.toString(), true, charset);
}

代码示例来源: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: org.apache.commons/httpclient

return false;
if (this.host.getPort() != connection.getPort()) {
  return false;

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

return false;
if (this.host.getPort() != connection.getPort()) {
  return false;

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

return false;
if (this.host.getPort() != connection.getPort()) {
  return false;

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

return false;
if (this.host.getPort() != connection.getPort()) {
  return false;

代码示例来源:origin: mesos/hadoop

httpAddress.getHostName() + ':' + httpAddress.getPort());
reportAddress.getHostName() + ':' + reportAddress.getPort());
        .newBuilder()
        .addRange(Value.Range.newBuilder()
          .setBegin(httpAddress.getPort())
          .setEnd(httpAddress.getPort()))
        .addRange(Value.Range.newBuilder()
          .setBegin(reportAddress.getPort())
          .setEnd(reportAddress.getPort()))))
.addResources(
  Resource

相关文章