Class HttpPrincipal
java.lang.Object
com.sun.net.httpserver.HttpPrincipal
- All Implemented Interfaces:
Principal
-
Constructor Summary
ConstructorDescriptionHttpPrincipal
(String username, String realm) Creates aHttpPrincipal
from the givenusername
andrealm
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compare two instances ofHttpPrincipal
.getName()
Returns the contents of this principal in the form realm:username.getRealm()
Returns therealm
this object was created with.Returns theusername
this object was created with.int
hashCode()
Returns a hashcode for thisHttpPrincipal
.toString()
Returns the same string asgetName()
.
-
Constructor Details
-
HttpPrincipal
Creates aHttpPrincipal
from the givenusername
andrealm
.- Parameters:
username
- the name of the user within the realmrealm
- the realm for this user- Throws:
NullPointerException
- if either username or realm arenull
-
-
Method Details
-
equals
Compare two instances ofHttpPrincipal
. Returnstrue
if another is an instance ofHttpPrincipal
, and its username and realm are equal to this object's username and realm. Returnsfalse
otherwise. -
getName
-
getUsername
Returns theusername
this object was created with.- Returns:
- the name of the user associated with this object
-
getRealm
Returns therealm
this object was created with.- Returns:
- the realm associated with this object
-
hashCode
-
toString
-