org.apache.commons.httpclient.protocol.Protocol.getScheme()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(167)

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

Protocol.getScheme介绍

[英]Returns the scheme.
[中]返回方案。

代码示例

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

/**
 * Return the host uri.
 * 
 * @return The host uri.
 */
public String toURI() {
  StringBuffer buffer = new StringBuffer(50);        
  buffer.append(this.protocol.getScheme());
  buffer.append("://");
  buffer.append(this.hostname);
  if (this.port != this.protocol.getDefaultPort()) {
    buffer.append(':');
    buffer.append(this.port);
  }
  return buffer.toString();
}

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

protected Protocol keepProtocol(String host, int port, String scheme) {
    final Protocol oldProtocol = getProtocol();
    if (oldProtocol != null) {
      final String oldScheme = oldProtocol.getScheme();
      if (oldScheme == scheme || (oldScheme != null && oldScheme.equalsIgnoreCase(scheme))) {
        return oldProtocol;
      }
    }
    return Protocol.getProtocol(scheme);
  }
}

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

/**
 * Return true if the specified object equals this object.
 * @param obj The object to compare against.
 * @return true if the objects are equal.
 */
public boolean equals(Object obj) {
  
  if (obj instanceof Protocol) {
    
    Protocol p = (Protocol) obj;
    
    return (
      defaultPort == p.getDefaultPort()
      && scheme.equalsIgnoreCase(p.getScheme())
      && secure == p.isSecure()
      && socketFactory.equals(p.getSocketFactory()));
    
  } else {
    return false;
  }
  
}

代码示例来源: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

buf.append(protocol.getScheme().toLowerCase());
buf.append("://");
buf.append(connection.getHost());

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

this.conn.getProtocol().getScheme(),
null,
this.conn.getHost(),

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

/**
 * Return the host uri.
 * 
 * @return The host uri.
 */
public String toURI() {
  StringBuffer buffer = new StringBuffer(50);        
  buffer.append(this.protocol.getScheme());
  buffer.append("://");
  buffer.append(this.hostname);
  if (this.port != this.protocol.getDefaultPort()) {
    buffer.append(':');
    buffer.append(this.port);
  }
  return buffer.toString();
}

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

private Protocol cloneProtocolKeepingSocketFactory(Protocol protocol)
{
  Protocol original = getProtocol();
  if (protocol.getScheme().equals(original.getScheme()))
  {
    // the protocol is the same, create a copy of it but keep the original socket factory
    return new Protocol(protocol.getScheme(), original.getSocketFactory(), 
      protocol.getDefaultPort());
  }
  return protocol;
}

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

/**
 * Return the host uri.
 * 
 * @return The host uri.
 */
public String toURI() {
  StringBuffer buffer = new StringBuffer(50);        
  buffer.append(this.protocol.getScheme());
  buffer.append("://");
  buffer.append(this.hostname);
  if (this.port != this.protocol.getDefaultPort()) {
    buffer.append(':');
    buffer.append(this.port);
  }
  return buffer.toString();
}

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

/**
 * Return the host uri.
 * 
 * @return The host uri.
 */
public String toURI() {
  StringBuffer buffer = new StringBuffer(50);        
  buffer.append(this.protocol.getScheme());
  buffer.append("://");
  buffer.append(this.hostname);
  if (this.port != this.protocol.getDefaultPort()) {
    buffer.append(':');
    buffer.append(this.port);
  }
  return buffer.toString();
}

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

/**
 * Return the host uri.
 * 
 * @return The host uri.
 */
public String toURI() {
  StringBuffer buffer = new StringBuffer(50);        
  buffer.append(this.protocol.getScheme());
  buffer.append("://");
  buffer.append(this.hostname);
  if (this.port != this.protocol.getDefaultPort()) {
    buffer.append(':');
    buffer.append(this.port);
  }
  return buffer.toString();
}

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

protected Protocol keepProtocol(String host, int port, String scheme) {
    final Protocol oldProtocol = getProtocol();
    if (oldProtocol != null) {
      final String oldScheme = oldProtocol.getScheme();
      if (oldScheme == scheme || (oldScheme != null && oldScheme.equalsIgnoreCase(scheme))) {
        return oldProtocol;
      }
    }
    return Protocol.getProtocol(scheme);
  }
}

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

protected Protocol keepProtocol(String host, int port, String scheme) {
    final Protocol oldProtocol = getProtocol();
    if (oldProtocol != null) {
      final String oldScheme = oldProtocol.getScheme();
      if (oldScheme == scheme || (oldScheme != null && oldScheme.equalsIgnoreCase(scheme))) {
        return oldProtocol;
      }
    }
    return Protocol.getProtocol(scheme);
  }
}

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

protected Protocol keepProtocol(String host, int port, String scheme) {
    final Protocol oldProtocol = getProtocol();
    if (oldProtocol != null) {
      final String oldScheme = oldProtocol.getScheme();
      if (oldScheme == scheme || (oldScheme != null && oldScheme.equalsIgnoreCase(scheme))) {
        return oldProtocol;
      }
    }
    return Protocol.getProtocol(scheme);
  }
}

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

protected Protocol keepProtocol(String host, int port, String scheme) {
    final Protocol oldProtocol = getProtocol();
    if (oldProtocol != null) {
      final String oldScheme = oldProtocol.getScheme();
      if (oldScheme == scheme || (oldScheme != null && oldScheme.equalsIgnoreCase(scheme))) {
        return oldProtocol;
      }
    }
    return Protocol.getProtocol(scheme);
  }
}

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

/**
 * Return true if the specified object equals this object.
 * @param obj The object to compare against.
 * @return true if the objects are equal.
 */
public boolean equals(Object obj) {
  
  if (obj instanceof Protocol) {
    
    Protocol p = (Protocol) obj;
    
    return (
      defaultPort == p.getDefaultPort()
      && scheme.equalsIgnoreCase(p.getScheme())
      && secure == p.isSecure()
      && socketFactory.equals(p.getSocketFactory()));
    
  } else {
    return false;
  }
  
}

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

/**
 * Return true if the specified object equals this object.
 * @param obj The object to compare against.
 * @return true if the objects are equal.
 */
public boolean equals(Object obj) {
  
  if (obj instanceof Protocol) {
    
    Protocol p = (Protocol) obj;
    
    return (
      defaultPort == p.getDefaultPort()
      && scheme.equalsIgnoreCase(p.getScheme())
      && secure == p.isSecure()
      && socketFactory.equals(p.getSocketFactory()));
    
  } else {
    return false;
  }
  
}

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

/**
 * Return true if the specified object equals this object.
 * @param obj The object to compare against.
 * @return true if the objects are equal.
 */
public boolean equals(Object obj) {
  
  if (obj instanceof Protocol) {
    
    Protocol p = (Protocol) obj;
    
    return (
      defaultPort == p.getDefaultPort()
      && scheme.equalsIgnoreCase(p.getScheme())
      && secure == p.isSecure()
      && socketFactory.equals(p.getSocketFactory()));
    
  } else {
    return false;
  }
  
}

代码示例来源:origin: net.exogeni.orca.core/shirako

private synchronized void overrideHttps() {
    Protocol proto = getProtocol();
    String host = getHost();
    if (null != proto && null != host) {
      if ("https" == proto.getScheme()) {
        super.setHost(host,
               getPort(),
               nullhttps);
      }
    }
  }
}

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

public static URI newURI(HttpMethod m, HostConfiguration conf) throws URIException {
    String scheme = conf.getProtocol().getScheme();
    String host = conf.getHost();
    int port = conf.getPort();
    return new URIBuilder().getURI(scheme, host, port, m.getPath(),
        m.getQueryString(), m.getParams());
  }
}

相关文章