java.lang.Object
com.sun.net.httpserver.HttpPrincipal
- All Implemented Interfaces:
- Principal
public class HttpPrincipal extends Object implements Principal
Represents a user authenticated by HTTP Basic or Digest
 authentication.
- 
Constructor SummaryConstructors Constructor Description HttpPrincipal(String username, String realm)creates a HttpPrincipal from the given username and realm
- 
Method SummaryModifier and Type Method Description booleanequals(Object another)Compares two HttpPrincipal.StringgetName()returns the contents of this principal in the form realm:usernameStringgetRealm()returns the realm this object was created with.StringgetUsername()returns the username this object was created with.inthashCode()returns a hashcode for this HttpPrincipal.StringtoString()returns the same string as getName()
- 
Constructor Details- 
HttpPrincipalcreates a HttpPrincipal from the given username and realm- Parameters:
- username- The name of the user within the realm
- realm- The realm.
- Throws:
- NullPointerException- if either username or realm are null
 
 
- 
- 
Method Details- 
equalsCompares two HttpPrincipal. Returnstrueif another is an instance of HttpPrincipal, and its username and realm are equal to this object's username and realm. Returnsfalseotherwise.
- 
getNamereturns the contents of this principal in the form realm:username
- 
getUsernamereturns the username this object was created with.
- 
getRealmreturns the realm this object was created with.
- 
hashCodepublic int hashCode()returns a hashcode for this HttpPrincipal. This is calculated as(getUsername()+getRealm().hashCode()- Specified by:
- hashCodein interface- Principal
- Overrides:
- hashCodein class- Object
- Returns:
- a hash code value for this object.
- See Also:
- Object.equals(java.lang.Object),- System.identityHashCode(java.lang.Object)
 
- 
toStringreturns the same string as getName()
 
-