Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.commons.httpclient.HostConfiguration
public class HostConfiguration
extends java.lang.Object
implements Cloneable
Field Summary | |
static HostConfiguration |
|
Constructor Summary | |
| |
|
Method Summary | |
Object |
|
boolean |
|
String |
|
String |
|
InetAddress |
|
HostParams |
|
int |
|
Protocol |
|
String |
|
int |
|
String |
|
int |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void | |
void |
|
void |
|
void | |
void | |
void | |
void |
|
void |
|
void |
|
void |
|
String |
|
public static final HostConfiguration ANY_HOST_CONFIGURATION
A value to represent any host configuration, instead of using something likenull
. This value should be treated as immutable and only used in lookups and other such places to represent "any" host config.
public HostConfiguration()
Constructor for HostConfiguration.
public HostConfiguration(HostConfiguration hostConfiguration)
Copy constructor for HostConfiguration
- Parameters:
hostConfiguration
- the hostConfiguration to copy
public Object clone()
- See Also:
java.lang.Object.clone()
public boolean equals(Object o)
- See Also:
java.lang.Object.equals(java.lang.Object)
public String getHost()
Returns the host.
- Returns:
- the host(IP or DNS name), or
null
if not set
- See Also:
isHostSet()
public String getHostURL()
Return the host url.
- Returns:
- The host url.
public InetAddress getLocalAddress()
Return the local address to be used when creating connections. If this is unset, the default address should be used.
- Returns:
- the local address to be used when creating Sockets, or
null
public HostParams getParams()
ReturnsHTTP protocol parameters
associated with this host.
- Returns:
- HTTP parameters.
- Since:
- 3.0
public int getPort()
Returns the port.
- Returns:
- the host port, or
-1
if not set
- See Also:
isHostSet()
public String getProxyHost()
Returns the proxyHost.
- Returns:
- the proxy host, or
null
if not set
- See Also:
isProxySet()
public int getProxyPort()
Returns the proxyPort.
- Returns:
- the proxy port, or
-1
if not set
- See Also:
isProxySet()
public String getVirtualHost()
Deprecated. use HostParams
Returns the virtual host.
- Returns:
- the virtual host name, or
null
if not set
public int hashCode()
- See Also:
java.lang.Object.hashCode()
public boolean hostEquals(HttpConnection connection)
Tests if the host configuration equals the configuration set on the connection. True only if the host, port, protocol, local address and virtual address are equal. If no host configuration has been set false will be returned.
- Parameters:
connection
- the connection to test against
- Returns:
true
if the connection's host information equals that of this configuration
- See Also:
proxyEquals(HttpConnection)
public boolean isHostSet()
Deprecated. no longer used
Returns true if the host is set.
- Returns:
true
if the host is set.
public boolean isProxySet()
Deprecated. no longer used
Tests if the proxy host/port have been set.
- Returns:
true
if a proxy server has been set.
- See Also:
setProxy(String,int)
public boolean proxyEquals(HttpConnection connection)
Tests if the proxy configuration equals the configuration set on the connection. True only if the proxyHost and proxyPort are equal.
- Parameters:
connection
- the connection to test against
- Returns:
true
if the connection's proxy information equals that of this configuration
- See Also:
hostEquals(HttpConnection)
public void setHost(String host)
Set the given host. Uses the default protocol("http") and its port.
- Parameters:
host
- The host(IP or DNS name).
public void setHost(String host, String virtualHost, int port, Protocol protocol)
Deprecated. #setHost(String, int, Protocol)
Sets the given host, virtual host, port and protocol.
- Parameters:
host
- the host(IP or DNS name)virtualHost
- the virtual host name ornull
port
- the host port or -1 to use protocol defaultprotocol
- the protocol
public void setHost(String host, int port)
Sets the given host and port. Uses the default protocol "http".
- Parameters:
host
- the host(IP or DNS name)port
- The port
public void setHost(String host, int port, String protocol)
Sets the given host, port and protocol
- Parameters:
host
- the host(IP or DNS name)port
- The portprotocol
- The protocol.
public void setHost(String host, int port, Protocol protocol)
Sets the given host, port and protocol.
- Parameters:
host
- the host(IP or DNS name)port
- The portprotocol
- the protocol
public void setHost(URI uri)
Sets the protocol, host and port from the given URI.
- Parameters:
uri
- the URI.
public void setLocalAddress(InetAddress localAddress)
Set the local address to be used when creating connections. If this is unset, the default address will be used. This is useful for specifying the interface to use on multi-homed or clustered systems.
- Parameters:
localAddress
- the local address to use
public void setParams(HostParams params)
AssignsHTTP protocol parameters
specific to this host.
- Since:
- 3.0
- See Also:
HostParams
public void setProxy(String proxyHost, int proxyPort)
Set the proxy settings.
- Parameters:
proxyHost
- The proxy hostproxyPort
- The proxy port
public void setProxyHost(ProxyHost proxyHost)
Sets the given proxy host
- Parameters:
proxyHost
- the proxy host
public String toString()
- See Also:
java.lang.Object.toString()