Android
org.apache.http
public final class

org.apache.http.HttpHost

java.lang.Object
org.apache.http.HttpHost Cloneable

Holds all of the variables needed to describe an HTTP connection to a host. This includes remote host name, port and scheme.

Summary

Constants

      Value  
String  DEFAULT_SCHEME_NAME  The default scheme is "http".  "http" 

Fields

protected    final  String  hostname  The host to use. 
protected    final  String  lcHostname  The lowercase host, for equals(Object) and hashCode()
protected    final  int  port  The port to use. 
protected    final  String  schemeName  The scheme  

Public Constructors

            HttpHost(String hostname, int port, String scheme)
Creates a new HttpHost, specifying all values.
            HttpHost(String hostname, int port)
Creates a new HttpHost, with default scheme.
            HttpHost(String hostname)
Creates a new HttpHost, with default scheme and port.
            HttpHost(HttpHost httphost)
Copy constructor for HttpHost.

Public Methods

          Object  clone()
Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
          boolean  equals(Object obj)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
          String  getHostName()
Returns the host name.
          int  getPort()
Returns the port.
          String  getSchemeName()
Returns the scheme name.
          int  hashCode()
Returns an integer hash code for the receiver.
          String  toHostString()
Obtains the host string, without scheme prefix.
          String  toString()
Returns a string containing a concise, human-readable description of the receiver.
          String  toURI()
Return the host URI, as a string.
Methods inherited from class java.lang.Object

Details

Constants

public static final String DEFAULT_SCHEME_NAME

The default scheme is "http".
Constant Value: "http"

Fields

protected final String hostname

The host to use.

protected final String lcHostname

The lowercase host, for equals(Object) and hashCode().

protected final int port

The port to use.

protected final String schemeName

The scheme

Public Constructors

public HttpHost(String hostname, int port, String scheme)

Creates a new HttpHost, specifying all values. Constructor for HttpHost.

Parameters

hostname the hostname (IP or DNS name)
port the port number. -1 indicates the scheme default port.
scheme the name of the scheme. null indicates the default scheme

public HttpHost(String hostname, int port)

Creates a new HttpHost, with default scheme.

Parameters

hostname the hostname (IP or DNS name)
port the port number. -1 indicates the scheme default port.

public HttpHost(String hostname)

Creates a new HttpHost, with default scheme and port.

Parameters

hostname the hostname (IP or DNS name)

public HttpHost(HttpHost httphost)

Copy constructor for HttpHost.

Parameters

httphost the HTTP host to copy details from

Public Methods

public Object clone()

Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.

Classes which wish to support cloning must specify that they implement the Cloneable interface, since the implementation checks for this.

Returns

  • Object a shallow copy of this object.

public boolean equals(Object obj)

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. The implementation in Object returns true only if the argument is the exact same object as the receiver (==).

Parameters

obj Object the object to compare with this object.

Returns

  • boolean true if the object is the same as this object false if it is different from this object.

public String getHostName()

Returns the host name.

Returns

  • the host name (IP or DNS name)

public int getPort()

Returns the port.

Returns

  • the host port, or -1 if not set

public String getSchemeName()

Returns the scheme name.

Returns

  • the scheme name

public int hashCode()

Returns an integer hash code for the receiver. Any two objects which answer true when passed to .equals must answer the same value for this method.

Returns

  • int the receiver's hash.

See Also

public String toHostString()

Obtains the host string, without scheme prefix.

Returns

  • the host string, for example localhost:8080

public String toString()

Returns a string containing a concise, human-readable description of the receiver.

Returns

  • String a printable representation for the receiver.

public String toURI()

Return the host URI, as a string.

Returns

  • the host URI
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56