- java.lang.Object
-
- com.sun.net.httpserver.HttpPrincipal
-
-
Constructor Summary
Constructors Constructor Description HttpPrincipal(String username, String realm)creates a HttpPrincipal from the given username and realm
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier 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 Detail
-
HttpPrincipal
public HttpPrincipal(String username, String realm)
creates a HttpPrincipal from the given username and realm- Parameters:
username- The name of the user within the realmrealm- The realm.- Throws:
NullPointerException- if either username or realm are null
-
-
Method Detail
-
equals
public boolean equals(Object another)
Compares two HttpPrincipal. Returnstrueif another is an instance of HttpPrincipal, and its username and realm are equal to this object's username and realm. Returnsfalseotherwise.- Specified by:
equalsin interfacePrincipal- Overrides:
equalsin classObject- Parameters:
another- Object the object to compare with this object.- Returns:
- boolean
trueif the object is the same as this objectfalseif it is different from this object. - See Also:
Object.hashCode()
-
getName
public String getName()
returns the contents of this principal in the form realm:username
-
getUsername
public String getUsername()
returns the username this object was created with.
-
getRealm
public String getRealm()
returns the realm this object was created with.
-
hashCode
public int hashCode()
returns a hashcode for this HttpPrincipal. This is calculated as(getUsername()+getRealm().hashCode()- Specified by:
hashCodein interfacePrincipal- Overrides:
hashCodein classObject- Returns:
- the receiver's hash.
- See Also:
Object.equals(java.lang.Object)
-
-