Constructor and Description |
---|
HttpPrincipal(String username,
String realm)
creates a HttpPrincipal from the given username and realm
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object another)
Compares two HttpPrincipal.
|
String |
getName()
returns the contents of this principal in the form
realm:username
|
String |
getRealm()
returns the realm this object was created with.
|
String |
getUsername()
returns the username this object was created with.
|
int |
hashCode()
returns a hashcode for this HttpPrincipal.
|
String |
toString()
returns the same string as getName()
|
public HttpPrincipal(String username, String realm)
username
- The name of the user within the realmrealm
- The realm.NullPointerException
- if either username or realm are nullpublic boolean equals(Object another)
true
if another is an instance of HttpPrincipal, and its
username and realm are equal to this object's username
and realm. Returns false
otherwise.public String getName()
public String getUsername()
public String getRealm()
public int hashCode()
(getUsername()+getRealm().hashCode()
hashCode
in interface Principal
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
Copyright © 2005, 2015, Oracle and/or its affiliates. All rights reserved.