public final class CloseStatus extends Object
Modifier and Type | Field and Description |
---|---|
static CloseStatus |
BAD_DATA
"1007 indicates that an endpoint is terminating the connection because it has
received data within a message that was not consistent with the type of the message
(e.g., non-UTF-8 [RFC3629] data within a text message)."
|
static CloseStatus |
GOING_AWAY
"1001 indicates that an endpoint is "going away", such as a server going down or a
browser having navigated away from a page."
|
static CloseStatus |
NO_CLOSE_FRAME
"1006 is a reserved value and MUST NOT be set as a status code in a Close control
frame by an endpoint.
|
static CloseStatus |
NO_STATUS_CODE
"1005 is a reserved value and MUST NOT be set as a status code in a Close control
frame by an endpoint.
|
static CloseStatus |
NORMAL
"1000 indicates a normal closure, meaning that the purpose for which the connection
was established has been fulfilled."
|
static CloseStatus |
NOT_ACCEPTABLE
"1003 indicates that an endpoint is terminating the connection because it has
received a type of data it cannot accept (e.g., an endpoint that understands only
text data MAY send this if it receives a binary message)."
|
static CloseStatus |
POLICY_VIOLATION
"1008 indicates that an endpoint is terminating the connection because it has
received a message that violates its policy.
|
static CloseStatus |
PROTOCOL_ERROR
"1002 indicates that an endpoint is terminating the connection due to a protocol
error."
|
static CloseStatus |
REQUIRED_EXTENSION
"1010 indicates that an endpoint (client) is terminating the connection because it
has expected the server to negotiate one or more extension, but the server didn't
return them in the response message of the WebSocket handshake.
|
static CloseStatus |
SERVER_ERROR
"1011 indicates that a server is terminating the connection because it encountered
an unexpected condition that prevented it from fulfilling the request."
|
static CloseStatus |
SERVICE_OVERLOAD
"1013 indicates that the service is experiencing overload.
|
static CloseStatus |
SERVICE_RESTARTED
"1012 indicates that the service is restarted.
|
static CloseStatus |
TLS_HANDSHAKE_FAILURE
"1015 is a reserved value and MUST NOT be set as a status code in a Close control
frame by an endpoint.
|
static CloseStatus |
TOO_BIG_TO_PROCESS
"1009 indicates that an endpoint is terminating the connection because it has
received a message that is too big for it to process."
|
Constructor and Description |
---|
CloseStatus(int code)
Create a new
CloseStatus instance. |
CloseStatus(int code,
String reason)
Create a new
CloseStatus instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
boolean |
equalsCode(CloseStatus other) |
int |
getCode()
Return the status code.
|
String |
getReason()
Return the reason, or
null if none. |
int |
hashCode() |
String |
toString() |
CloseStatus |
withReason(String reason)
Create a new
CloseStatus from this one with the specified reason. |
public static final CloseStatus NORMAL
public static final CloseStatus GOING_AWAY
public static final CloseStatus PROTOCOL_ERROR
public static final CloseStatus NOT_ACCEPTABLE
public static final CloseStatus NO_STATUS_CODE
public static final CloseStatus NO_CLOSE_FRAME
public static final CloseStatus BAD_DATA
public static final CloseStatus POLICY_VIOLATION
public static final CloseStatus TOO_BIG_TO_PROCESS
public static final CloseStatus REQUIRED_EXTENSION
public static final CloseStatus SERVER_ERROR
public static final CloseStatus SERVICE_RESTARTED
public static final CloseStatus SERVICE_OVERLOAD
public static final CloseStatus TLS_HANDSHAKE_FAILURE
public CloseStatus(int code)
CloseStatus
instance.code
- the status codepublic CloseStatus(int code, @Nullable String reason)
CloseStatus
instance.code
- the status codereason
- the reasonpublic int getCode()
public CloseStatus withReason(String reason)
CloseStatus
from this one with the specified reason.reason
- the reasonCloseStatus
instancepublic boolean equalsCode(CloseStatus other)