public class WebSocketURI extends Object
Limitations of this implementation:
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NOT_SECURE_PORT
The default port for a ws:// URI as defined in RFC6455 (see section 3).
|
static int |
DEFAULT_SECURE_PORT
The default port for a wss:// URI.
|
Constructor and Description |
---|
WebSocketURI(String host)
Create a new (not secure) websocket URI.
|
WebSocketURI(String host,
int port)
Create a new (not secure) websocket URI.
|
WebSocketURI(String host,
int port,
String resourceName)
Create a new (not secure) websocket URI.
|
WebSocketURI(String host,
int port,
String resourceName,
boolean isSecure)
Create a new websocket URI.
|
WebSocketURI(String host,
String resourceName)
Create a new (not secure) websocket URI.
|
Modifier and Type | Method and Description |
---|---|
String |
getHost()
Get the host (hostname or IP address).
|
int |
getPort()
Get the port of the host.
|
String |
getResourceName()
Get the resource name, that is the name of the remote websocket endpoint.
|
boolean |
isSecure()
Tell if the websocket is secured or not.
|
String |
toString()
Returns a string representation of the object.
|
public static final int DEFAULT_NOT_SECURE_PORT
public static final int DEFAULT_SECURE_PORT
public WebSocketURI(String host) throws IllegalArgumentException
DEFAULT_NOT_SECURE_PORT
) is used.host
- hostname or IP address of the remote hostIllegalArgumentException
- if resourceName is nullpublic WebSocketURI(String host, int port) throws IllegalArgumentException
host
- hostname or IP address of the remote hostport
- port of the remote hostIllegalArgumentException
- if resourceName is nullpublic WebSocketURI(String host, int port, String resourceName) throws IllegalArgumentException
host
- hostname or IP address of the remote hostport
- port of the remote hostresourceName
- identifier for the service provided by the serverIllegalArgumentException
- if host is null or empty; if port is 0 (zero); if
resourceName is nullpublic WebSocketURI(String host, int port, String resourceName, boolean isSecure) throws IllegalArgumentException
host
- hostname or IP address of the remote hostport
- port of the remote hostresourceName
- identifier for the service provided by the serverisSecure
- flag indicating if the websocket is secure (wss) or notIllegalArgumentException
- if host is null or empty; if port is 0 (zero); if
resourceName is nullpublic WebSocketURI(String host, String resourceName) throws IllegalArgumentException
DEFAULT_NOT_SECURE_PORT
) is used.host
- hostname or IP address of the remote hostresourceName
- identifier for the service provided by the serverIllegalArgumentException
- if resourceName is nullpublic String getHost()
public int getPort()
public String getResourceName()
public boolean isSecure()
public String toString()
Object
toString
method returns a
string that "textually represents" this object. The result should be a concise but informative
representation that is easy for a person to read. It is recommended that all subclasses override
this method.
The toString
method for class Object
returns a string consisting of the name of
the class of which the object is an instance, the at-sign character `@
', and the unsigned
hexadecimal representation of the hash code of the object. In other words, this method returns a
string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())