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
-
-
Field Summary
Fields Modifier and Type Field Description private Host
host
private static long
serialVersionUID
private java.lang.String
userInfo
-
Constructor Summary
Constructors Constructor Description URIAuthority(java.lang.String hostname)
URIAuthority(java.lang.String hostname, int port)
URIAuthority(java.lang.String userInfo, java.lang.String hostname, int port)
Constructs a new instance.URIAuthority(java.lang.String userInfo, Host host)
URIAuthority(java.lang.String userInfo, NamedEndpoint endpoint)
URIAuthority(Host host)
URIAuthority(NamedEndpoint namedEndpoint)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static URIAuthority
create(java.lang.String s)
Creates aURIAuthority
instance from a string.boolean
equals(java.lang.Object obj)
(package private) static void
format(java.lang.StringBuilder buf, URIAuthority uriAuthority)
(package private) static java.lang.String
format(URIAuthority uriAuthority)
java.lang.String
getHostName()
Returns name (IP or DNS name).int
getPort()
Returns the port.java.lang.String
getUserInfo()
int
hashCode()
(package private) static URIAuthority
parse(java.lang.CharSequence s)
(package private) static URIAuthority
parse(java.lang.CharSequence s, Tokenizer.Cursor cursor)
java.lang.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
userInfo
private final java.lang.String userInfo
-
host
private final Host host
-
-
Constructor Detail
-
URIAuthority
public URIAuthority(java.lang.String userInfo, java.lang.String hostname, int port)
Constructs a new instance.- Throws:
java.lang.IllegalArgumentException
- If the port parameter is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1
indicates the scheme default port.
-
URIAuthority
public URIAuthority(java.lang.String hostname, int port)
-
URIAuthority
public URIAuthority(java.lang.String userInfo, Host host)
- Since:
- 5.2
-
URIAuthority
public URIAuthority(Host host)
- Since:
- 5.2
-
URIAuthority
public URIAuthority(java.lang.String userInfo, NamedEndpoint endpoint)
- Since:
- 5.2
-
URIAuthority
public URIAuthority(NamedEndpoint namedEndpoint)
-
URIAuthority
public URIAuthority(java.lang.String hostname)
-
-
Method Detail
-
parse
static URIAuthority parse(java.lang.CharSequence s, Tokenizer.Cursor cursor) throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
-
parse
static URIAuthority parse(java.lang.CharSequence s) throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
-
format
static void format(java.lang.StringBuilder buf, URIAuthority uriAuthority)
-
format
static java.lang.String format(URIAuthority uriAuthority)
-
create
public static URIAuthority create(java.lang.String s) throws java.net.URISyntaxException
Creates aURIAuthority
instance from a string. Text may not contain any blanks.- Throws:
java.net.URISyntaxException
-
getUserInfo
public java.lang.String getUserInfo()
-
getHostName
public java.lang.String getHostName()
Description copied from interface:NamedEndpoint
Returns name (IP or DNS name).- Specified by:
getHostName
in interfaceNamedEndpoint
- Returns:
- the host name (IP or DNS name)
-
getPort
public int getPort()
Description copied from interface:NamedEndpoint
Returns the port.- Specified by:
getPort
in interfaceNamedEndpoint
- Returns:
- the host port, or
-1
if not set
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-