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

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

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

HttpConnection.getPort介绍

[英]Returns the port of the host. If the port is -1 (or less than 0) the default port for the current protocol is returned.
[中]返回主机的端口。如果端口为-1(或小于0),则返回当前协议的默认端口。

代码示例

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

public int getPort() {
  if (hasConnection()) {
    return wrappedConnection.getPort();
  } else {
    return -1;
  }
}

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

/**
 * Creates a new HttpConnectionAdapter.
 * @param connection the connection to be wrapped
 */
public HttpConnectionAdapter(HttpConnection connection) {
  super(connection.getHost(), connection.getPort(), connection.getProtocol());
  this.wrappedConnection = connection;
}

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

buf.append("://");
buf.append(connection.getHost());
if ((connection.getPort() != -1) 
  && (connection.getPort() != protocol.getDefaultPort())
) {
  buf.append(":");
  buf.append(connection.getPort());

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

host = conn.getHost();
int port = conn.getPort();

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

buffer.append(getPath()); 
} else {
  int port = conn.getPort();
  if (port == -1) {
    port = conn.getProtocol().getDefaultPort();

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

cookies = parser.parse(
 host,
 conn.getPort(),
 getPath(),
 conn.isSecure(),
    parser.validate(
     host,
     conn.getPort(),
     getPath(),
     conn.isSecure(),

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

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

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

host = conn.getHost();
int port = conn.getPort();
AuthScope authscope = new AuthScope(
  host, port,

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

host = conn.getHost();
int port = conn.getPort();
AuthScope authscope = new AuthScope(
  host, port,

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

null,
  this.conn.getHost(), 
  this.conn.getPort(), 
  method.getPath()
);

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

/**
 * Gets the host configuration for a connection.
 * @param conn the connection to get the configuration of
 * @return a new HostConfiguration
 */
private HostConfiguration configurationForConnection(HttpConnection conn) {
  HostConfiguration connectionConfiguration = new HostConfiguration();
  
  connectionConfiguration.setHost(
    conn.getHost(), 
    conn.getPort(), 
    conn.getProtocol()
  );
  if (conn.getLocalAddress() != null) {
    connectionConfiguration.setLocalAddress(conn.getLocalAddress());
  }
  if (conn.getProxyHost() != null) {
    connectionConfiguration.setProxy(conn.getProxyHost(), conn.getProxyPort());
  }
  return connectionConfiguration;
}

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

host = conn.getHost();
Cookie[] cookies = matcher.match(host, conn.getPort(),
  getPath(), conn.isSecure(), state.getCookies());
if ((cookies != null) && (cookies.length > 0)) {

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

public int getPort() {
  if (hasConnection()) {
    return wrappedConnection.getPort();
  } else {
    return -1;
  }
}

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

public int getPort() {
  if (hasConnection()) {
    return wrappedConnection.getPort();
  } else {
    return -1;
  }
}

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

public int getPort() {
  if (hasConnection()) {
    return wrappedConnection.getPort();
  } else {
    return -1;
  }
}

代码示例来源:origin: org.sonatype.nexus/nexus-proxy

public int getPort() {
  if (hasConnection()) {
    return wrappedConnection.getPort();
  } else {
    return -1;
  }
}

代码示例来源:origin: org.sonatype.nexus/nexus-proxy

/**
 * Creates a new HttpConnectionAdapter.
 * @param connection the connection to be wrapped
 */
public HttpConnectionAdapter(HttpConnection connection) {
  super(connection.getHost(), connection.getPort(), connection.getProtocol());
  this.wrappedConnection = connection;
}

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

/**
 * Creates a new HttpConnectionAdapter.
 * @param connection the connection to be wrapped
 */
public HttpConnectionAdapter(HttpConnection connection) {
  super(connection.getHost(), connection.getPort(), connection.getProtocol());
  this.wrappedConnection = connection;
}

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

/**
 * Creates a new HttpConnectionAdapter.
 * @param connection the connection to be wrapped
 */
public HttpConnectionAdapter(HttpConnection connection) {
  super(connection.getHost(), connection.getPort(), connection.getProtocol());
  this.wrappedConnection = connection;
}

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

/**
 * Creates a new HttpConnectionAdapter.
 * @param connection the connection to be wrapped
 */
public HttpConnectionAdapter(HttpConnection connection) {
  super(connection.getHost(), connection.getPort(), connection.getProtocol());
  this.wrappedConnection = connection;
}

相关文章

微信公众号

最新文章

更多

HttpConnection类方法