Class HTTPClient.AuthorizationInfo
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class HTTPClient.AuthorizationInfo

java.lang.Object
   |
   +----HTTPClient.AuthorizationInfo

public class AuthorizationInfo
extends Object
Holds the information for an authorization response.
Version:
0.2 (bug fix 2) 23/03/1997
Author:
Ronald Tschalär

Constructor Index

 o AuthorizationInfo(String, int, String, String, NVPair[])
Creates a new info structure for the specified host and port with the specified scheme, realm, params.
 o AuthorizationInfo(String, int, String, String, String)
Creates a new info structure for the specified host and port with the specified scheme, realm and "basic" cookie.

Method Index

 o addAuthorization(String, int, String, String, String, NVPair[])
Add's an authorization entry to the list.
 o addBasicAuthorization(String, int, String, String, String)
Add's an authorization entry for the "basic" authorization scheme to the list.
 o equals(Object)
Two AuthorizationInfos are considered equal if their Host, Port, Scheme and Realm match.
 o getHost()
Get the host.
 o getParams()
Get the authorization parameters.
 o getPort()
Get the port.
 o getRealm()
Get the realm.
 o getScheme()
Get the scheme.
 o hashCode()
Produces a hash code based on Host, Scheme and Realm.
 o setAuthHandler(AuthorizationHandler)
Set's the authorization handler.
 o toString()
Constructs a string containing the authorization info.

Constructors

 o AuthorizationInfo
  public AuthorizationInfo(String host,
                           int port,
                           String scheme,
                           String realm,
                           NVPair params[])
Creates a new info structure for the specified host and port with the specified scheme, realm, params. The "basic" cookie is set to null.
Parameters:
host - the host
port - the port
scheme - the scheme
realm - the realm
params - the parameters as an array of name/value pairs
 o AuthorizationInfo
  public AuthorizationInfo(String host,
                           int port,
                           String scheme,
                           String realm,
                           String cookie)
Creates a new info structure for the specified host and port with the specified scheme, realm and "basic" cookie. The params is set to a zero-length array.
Parameters:
host - the host
port - the port
scheme - the scheme
realm - the realm
cookie - the encoded username/password for the "basic" scheme

Methods

 o setAuthHandler
  public static AuthorizationHandler setAuthHandler(AuthorizationHandler handler)
Set's the authorization handler. This handler is called whenever the server requests authorization and no entry for the requested scheme and realm can be found in the list. The handler must implement the AuthorizationHandler interface.
If no handler is set then a default handler is used. This handler currently only handles the "basic" scheme and brings up a popup which prompts for the username and password.
Parameters:
handler - the new authorization handler
Returns:
the old authorization handler
See Also:
AuthorizationHandler
 o addAuthorization
  public static void addAuthorization(String host,
                                      int port,
                                      String scheme,
                                      String realm,
                                      String cookie,
                                      NVPair params[])
Add's an authorization entry to the list. If an entry for the specified scheme and realm already exists then its cookie and params are replaced with the new data.
Parameters:
host - the host
port - the port
scheme - the scheme
realm - the realm
cookie - the string used for the "basic" authorization scheme
params - an array of name/value pairs of parameters
 o addBasicAuthorization
  public static void addBasicAuthorization(String host,
                                           int port,
                                           String realm,
                                           String user,
                                           String passw)
Add's an authorization entry for the "basic" authorization scheme to the list. If an entry already exists for the "basic" scheme and the specified realm then it is overwritten.
Parameters:
host - the host
port - the port
realm - the realm
user - the username
passw - the password
 o getHost
  public final String getHost()
Get the host.
Returns:
a string containing the host name.
 o getPort
  public final int getPort()
Get the port.
Returns:
an int containing the port number.
 o getScheme
  public final String getScheme()
Get the scheme.
Returns:
a string containing the scheme.
 o getRealm
  public final String getRealm()
Get the realm.
Returns:
a string containing the realm.
 o getParams
  public final NVPair[] getParams()
Get the authorization parameters.
Returns:
an array of name/value pairs.
 o toString
  public String toString()
Constructs a string containing the authorization info. The format is that of the http header Authenticate.
Returns:
a String containing all info.
Overrides:
toString in class Object
 o hashCode
  public int hashCode()
Produces a hash code based on Host, Scheme and Realm. Port is not included for simplicity (and because it probably won't make much difference). Used in the AuthorizationInfo.AuthList hash table.
Returns:
the hash code
Overrides:
hashCode in class Object
 o equals
  public boolean equals(Object obj)
Two AuthorizationInfos are considered equal if their Host, Port, Scheme and Realm match. Used in the AuthorizationInfo.AuthList hash table.
Parameters:
obj - another AuthorizationInfo against which this one is to be compared.
Returns:
true if they match in the above mentioned fields; false otherwise.
Overrides:
equals in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index