org.apache.commons.httpclient
Class HostConfiguration

java.lang.Object
  |
  +--org.apache.commons.httpclient.HostConfiguration
All Implemented Interfaces:
java.lang.Cloneable

public class HostConfiguration
extends java.lang.Object
implements java.lang.Cloneable

Since:
2.0
Author:
Michael Becke

Constructor Summary
HostConfiguration()
          Constructor for HostConfiguration.
HostConfiguration(HostConfiguration hostConfiguration)
          Copy constructor for HostConfiguration
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getHost()
          Returns the host.
 java.lang.String getHostURL()
           
 int getPort()
          Returns the port.
 Protocol getProtocol()
          Returns the protocol.
 java.lang.String getProxyHost()
          Returns the proxyHost.
 int getProxyPort()
          Returns the proxyPort.
 int hashCode()
           
 boolean hostEquals(HttpConnection connection)
          Tests if the host configuration equals the configuraiton set on the connection.
 boolean isHostSet()
           
 boolean isProxySet()
           
 boolean proxyEquals(HttpConnection connection)
          Tests if the proxy configuration equals the configuraiton set on the connection.
 void setHost(java.lang.String host, int port, Protocol protocol)
          Sets this configuration's host infomation.
 void setHost(java.lang.String host, int port, java.lang.String protocol)
           
 void setHost(URI uri)
          Sets the protocol, host and port from the given URI.
 void setProxy(java.lang.String proxyHost, int proxyPort)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HostConfiguration

public HostConfiguration()
Constructor for HostConfiguration.


HostConfiguration

public HostConfiguration(HostConfiguration hostConfiguration)
Copy constructor for HostConfiguration

Parameters:
hostConfiguration - the hostConfiguration to copy
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object
See Also:
Object.clone()

hostEquals

public boolean hostEquals(HttpConnection connection)
Tests if the host configuration equals the configuraiton set on the connection. True only if the host, port and protocol 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)

proxyEquals

public boolean proxyEquals(HttpConnection connection)
Tests if the proxy configuration equals the configuraiton 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)

isHostSet

public boolean isHostSet()

setHost

public void setHost(java.lang.String host,
                    int port,
                    java.lang.String protocol)

setHost

public void setHost(java.lang.String host,
                    int port,
                    Protocol protocol)
Sets this configuration's host infomation.

Parameters:
host - the host, IP or DNS name
port - the host port or -1 to use protocol default
protocol - the protocol

setHost

public void setHost(URI uri)
Sets the protocol, host and port from the given URI.

Parameters:
uri - the URI.

getHostURL

public java.lang.String getHostURL()

getHost

public java.lang.String getHost()
Returns the host.

Returns:
String

getPort

public int getPort()
Returns the port.

Returns:
int

getProtocol

public Protocol getProtocol()
Returns the protocol.

Returns:
String

isProxySet

public boolean isProxySet()

setProxy

public void setProxy(java.lang.String proxyHost,
                     int proxyPort)

getProxyHost

public java.lang.String getProxyHost()
Returns the proxyHost.

Returns:
String

getProxyPort

public int getProxyPort()
Returns the proxyPort.

Returns:
int

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.