Package org.apache.hc.core5.net
Class URIAuthority
- java.lang.Object
-
- org.apache.hc.core5.net.URIAuthority
-
- All Implemented Interfaces:
java.io.Serializable,NamedEndpoint
@Contract(threading=IMMUTABLE) public final class URIAuthority extends java.lang.Object implements NamedEndpoint, java.io.Serializable
Represents authority component of requestURI.- Since:
- 5.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description URIAuthority(java.lang.String hostName)Constructs a new instance.URIAuthority(java.lang.String hostName, int port)Constructs a new instance.URIAuthority(java.lang.String userInfo, java.lang.String hostName, int port)Constructs a new instance.URIAuthority(java.lang.String userInfo, Host host)Constructs a new instance.URIAuthority(java.lang.String userInfo, NamedEndpoint endpoint)Constructs a new instance.URIAuthority(Host host)Constructs a new instance.URIAuthority(NamedEndpoint namedEndpoint)Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static URIAuthoritycreate(java.lang.String s)Creates aURIAuthorityinstance from a string.booleanequals(java.lang.Object obj)java.lang.StringgetHostName()Returns name (IP or DNS name).intgetPort()Returns the port.java.lang.StringgetUserInfo()Gets the user info String.inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
URIAuthority
public URIAuthority(java.lang.String userInfo, java.lang.String hostName, int port)Constructs a new instance.- Parameters:
userInfo- The user info, may be null.hostName- The host name, not null.port- The port value, between 0 and 65535, inclusive.-1indicates the scheme default port.- Throws:
java.lang.NullPointerException- If thenameisnull.java.lang.IllegalArgumentException- If the port is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1indicates the scheme default port.
-
URIAuthority
public URIAuthority(java.lang.String hostName, int port)Constructs a new instance.- Parameters:
hostName- The host name, not null.port- The port value, between 0 and 65535, inclusive.-1indicates the scheme default port.- Throws:
java.lang.NullPointerException- If thenameisnull.java.lang.IllegalArgumentException- If the port is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1indicates the scheme default port.
-
URIAuthority
public URIAuthority(java.lang.String userInfo, Host host)Constructs a new instance.- Parameters:
userInfo- The user info, may be null.host- The host, never null.- Throws:
java.lang.NullPointerException- if thehostisnull.- Since:
- 5.2
-
URIAuthority
public URIAuthority(Host host)
Constructs a new instance.- Parameters:
host- The host, never null.- Throws:
java.lang.NullPointerException- if thehostisnull.- Since:
- 5.2
-
URIAuthority
public URIAuthority(java.lang.String userInfo, NamedEndpoint endpoint)Constructs a new instance.- Parameters:
userInfo- The user info, may be null.endpoint- The named end-point, never null.- Throws:
java.lang.NullPointerException- If the end-point isnull.java.lang.NullPointerException- If the end-pointnameisnull.java.lang.IllegalArgumentException- If the end-point port is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1indicates the scheme default port.- Since:
- 5.2
-
URIAuthority
public URIAuthority(NamedEndpoint namedEndpoint)
Constructs a new instance.- Parameters:
namedEndpoint- The named end-point, never null.- Throws:
java.lang.NullPointerException- If the end-point isnull.java.lang.NullPointerException- If the end-pointnameisnull.java.lang.IllegalArgumentException- If the end-point port is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1indicates the scheme default port.
-
URIAuthority
public URIAuthority(java.lang.String hostName)
Constructs a new instance.- Parameters:
hostName- The host name, not null.- Throws:
java.lang.NullPointerException- If thenameisnull.
-
-
Method Detail
-
create
public static URIAuthority create(java.lang.String s) throws java.net.URISyntaxException
Creates aURIAuthorityinstance from a string. Text may not contain any blanks.- Parameters:
s- The value to parse- Returns:
- The parsed URIAuthority.
- Throws:
java.net.URISyntaxException- Thrown if a string could not be parsed as a URIAuthority.
-
getUserInfo
public java.lang.String getUserInfo()
Gets the user info String.- Returns:
- the user info String.
-
getHostName
public java.lang.String getHostName()
Description copied from interface:NamedEndpointReturns name (IP or DNS name).- Specified by:
getHostNamein interfaceNamedEndpoint- Returns:
- the host name (IP or DNS name)
-
getPort
public int getPort()
Description copied from interface:NamedEndpointReturns the port.- Specified by:
getPortin interfaceNamedEndpoint- Returns:
- the host port, or
-1if not set
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-