/** * 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(); }
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); } }
/** * 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; } }
/** * 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); }
buf.append(protocol.getScheme().toLowerCase()); buf.append("://"); buf.append(connection.getHost());
this.conn.getProtocol().getScheme(), null, this.conn.getHost(),
/** * 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(); }
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; }
/** * 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(); }
/** * 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(); }
/** * 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(); }
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); } }
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); } }
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); } }
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); } }
/** * 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; } }
/** * 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; } }
/** * 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; } }
private synchronized void overrideHttps() { Protocol proto = getProtocol(); String host = getHost(); if (null != proto && null != host) { if ("https" == proto.getScheme()) { super.setHost(host, getPort(), nullhttps); } } } }
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()); } }