public class HostConfigurationWithStickyProtocol extends HostConfiguration
This is useful for integrating a specialized Protocol or SocketFactory; for example, a SecureSocketFactory that authenticates via SSL. Use HttpClient.setHostConfiguration to install a HostConfigurationWithStickyProtocol that contains the specialized Protocol or SocketFactory.
An alternative is to use Protocol.registerProtocol to register a specialized Protocol. But that has drawbacks: it makes it hard to integrate modules (e.g. web applications in a servlet container) with different strategies, because they share the specialized Protocol (Protocol.PROTOCOLS is static). Also, it can't handle multiple socket factories for the same host and port, since the URL path isn't a parameter to Protocol.getProtocol or socket factory methods.
ANY_HOST_CONFIGURATION| Constructor and Description |
|---|
HostConfigurationWithStickyProtocol() |
HostConfigurationWithStickyProtocol(HostConfiguration hostConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
protected Protocol |
getNewProtocol(String host,
int port,
String scheme)
Select a Protocol to be used for the given host, port and scheme.
|
void |
setHost(String host,
int port,
String scheme)
Sets the given host, port and protocol
|
equals, getHost, getHostURL, getLocalAddress, getParams, getPort, getProtocol, getProxyHost, getProxyPort, getVirtualHost, hashCode, hostEquals, isHostSet, isProxySet, proxyEquals, setHost, setHost, setHost, setHost, setHost, setHost, setLocalAddress, setParams, setProxy, setProxyHost, toStringpublic HostConfigurationWithStickyProtocol()
public HostConfigurationWithStickyProtocol(HostConfiguration hostConfiguration)
public Object clone()
clone in class HostConfigurationObject.clone()public void setHost(String host, int port, String scheme)
HostConfigurationsetHost in class HostConfigurationhost - the host(IP or DNS name)port - The portscheme - The protocol.protected Protocol getNewProtocol(String host, int port, String scheme)
This implementation returns the current Protocol if it has the given scheme; otherwise it returns the Protocol registered for that scheme.
Copyright © 2012 Apache Software Foundation. All Rights Reserved.