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
-
AuthorizationInfo(String, int, String, String, NVPair[])
- Creates a new info structure for the specified host and port with the
specified scheme, realm, params.
-
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.
-
addAuthorization(String, int, String, String, String, NVPair[])
- Add's an authorization entry to the list.
-
addBasicAuthorization(String, int, String, String, String)
- Add's an authorization entry for the "basic" authorization scheme to
the list.
-
equals(Object)
- Two AuthorizationInfos are considered equal if their Host, Port,
Scheme and Realm match.
-
getHost()
- Get the host.
-
getParams()
- Get the authorization parameters.
-
getPort()
- Get the port.
-
getRealm()
- Get the realm.
-
getScheme()
- Get the scheme.
-
hashCode()
- Produces a hash code based on Host, Scheme and Realm.
-
setAuthHandler(AuthorizationHandler)
- Set's the authorization handler.
-
toString()
- Constructs a string containing the authorization info.
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
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
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
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
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
getHost
public final String getHost()
- Get the host.
- Returns:
- a string containing the host name.
getPort
public final int getPort()
- Get the port.
- Returns:
- an int containing the port number.
getScheme
public final String getScheme()
- Get the scheme.
- Returns:
- a string containing the scheme.
getRealm
public final String getRealm()
- Get the realm.
- Returns:
- a string containing the realm.
getParams
public final NVPair[] getParams()
- Get the authorization parameters.
- Returns:
- an array of name/value pairs.
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
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
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