Principal
public class HttpPrincipal extends Object implements Principal
Constructor | Description |
---|---|
HttpPrincipal |
Creates a HttpPrincipal from the given username and realm . |
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals |
Compare two instances of 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)
HttpPrincipal
from the given username
and realm
.username
- the name of the user within the realmrealm
- the realm for this userNullPointerException
- if either username or realm are null
public boolean equals(Object another)
HttpPrincipal
. Returns 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()
username
this object was created with.public String getRealm()
realm
this object was created with.public int hashCode()
HttpPrincipal
. This is calculated as (getUsername()+getRealm()).hashCode()
.public String toString()
getName()
.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.httpserver/com/sun/net/httpserver/HttpPrincipal.html