Build 1.0_r1(from source)

org.apache.http.auth
Class AuthScope

java.lang.Object
  extended by org.apache.http.auth.AuthScope

public class AuthScope
extends Object

The class represents an authentication scope consisting of a host name, a port number, a realm name and an authentication scheme name which Credentials apply to.

Since:
4.0

Field Summary
static AuthScope ANY
          Default scope matching any host, port, realm and authentication scheme.
static String ANY_HOST
          The null value represents any host.
static int ANY_PORT
          The -1 value represents any port.
static String ANY_REALM
          The null value represents any realm.
static String ANY_SCHEME
          The null value represents any authentication scheme.
 
Constructor Summary
AuthScope(AuthScope authscope)
          Creates a copy of the given credentials scope.
AuthScope(String host, int port)
          Creates a new credentials scope for the given host, port, any realm name, and any authentication scheme.
AuthScope(String host, int port, String realm)
          Creates a new credentials scope for the given host, port, realm, and any authentication scheme.
AuthScope(String host, int port, String realm, String scheme)
          Creates a new credentials scope for the given host, port, realm, and authentication scheme.
 
Method Summary
 boolean equals(Object o)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 String getHost()
           
 int getPort()
           
 String getRealm()
           
 String getScheme()
           
 int hashCode()
          Returns an integer hash code for the receiver.
 int match(AuthScope that)
          Tests if the authentication scopes match.
 String toString()
          Returns a string containing a concise, human-readable description of the receiver.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANY_HOST

public static final String ANY_HOST
The null value represents any host. In the future versions of HttpClient the use of this parameter will be discontinued.


ANY_PORT

public static final int ANY_PORT
The -1 value represents any port.

See Also:
Constant Field Values

ANY_REALM

public static final String ANY_REALM
The null value represents any realm.


ANY_SCHEME

public static final String ANY_SCHEME
The null value represents any authentication scheme.


ANY

public static final AuthScope ANY
Default scope matching any host, port, realm and authentication scheme. In the future versions of HttpClient the use of this parameter will be discontinued.

Constructor Detail

AuthScope

public AuthScope(String host,
                 int port,
                 String realm,
                 String scheme)
Creates a new credentials scope for the given host, port, realm, and authentication scheme.

Parameters:
host - the host the credentials apply to. May be set to null if credenticals are applicable to any host.
port - the port the credentials apply to. May be set to negative value if credenticals are applicable to any port.
realm - the realm the credentials apply to. May be set to null if credenticals are applicable to any realm.
scheme - the authentication scheme the credentials apply to. May be set to null if credenticals are applicable to any authentication scheme.

AuthScope

public AuthScope(String host,
                 int port,
                 String realm)
Creates a new credentials scope for the given host, port, realm, and any authentication scheme.

Parameters:
host - the host the credentials apply to. May be set to null if credenticals are applicable to any host.
port - the port the credentials apply to. May be set to negative value if credenticals are applicable to any port.
realm - the realm the credentials apply to. May be set to null if credenticals are applicable to any realm.

AuthScope

public AuthScope(String host,
                 int port)
Creates a new credentials scope for the given host, port, any realm name, and any authentication scheme.

Parameters:
host - the host the credentials apply to. May be set to null if credenticals are applicable to any host.
port - the port the credentials apply to. May be set to negative value if credenticals are applicable to any port.

AuthScope

public AuthScope(AuthScope authscope)
Creates a copy of the given credentials scope.

Method Detail

getHost

public String getHost()
Returns:
the host

getPort

public int getPort()
Returns:
the port

getRealm

public String getRealm()
Returns:
the realm name

getScheme

public String getScheme()
Returns:
the scheme type

match

public int match(AuthScope that)
Tests if the authentication scopes match.

Returns:
the match factor. Negative value signifies no match. Non-negative signifies a match. The greater the returned value the closer the match.

equals

public boolean equals(Object o)
Description copied from class: Object
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 (==).

Overrides:
equals in class Object
Parameters:
o - 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.
See Also:
Object.equals(Object)

toString

public String toString()
Description copied from class: Object
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
String a printable representation for the receiver.
See Also:
Object.toString()

hashCode

public int hashCode()
Description copied from class: Object
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.

Overrides:
hashCode in class Object
Returns:
int the receiver's hash.
See Also:
Object.hashCode()

Build 1.0_r1(from source)

Please submit a feedback, bug or feature