public class CloseFrame extends ControlFrame
Modifier and Type | Field and Description |
---|---|
static int |
ABNORMAL
Reserved (value 1006) and MUST NOT be set as a status code in a Close control
frame by an endpoint.
|
static int |
BAD_GATEWAY
Indicates (value 1014) that the server was acting as a gateway or proxy and
received an invalid response from the upstream server.
|
static int |
GOING_AWAY
Indicates (value 1001) that an endpoint is "going away", such as a server
going down or a browser having navigated away from a page.
|
static int |
MISSED_EXTENSION
Indicates (value 1010) 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 int |
NO_CODE
Reserved (value 1005) and MUST NOT be set as a status code in a Close control
frame by an endpoint.
|
static int |
NON_UTF8
Indicates (value 1007) 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 int |
NORMAL
Indicates (value 1000) a normal closure, meaning that the purpose for which
the connection was established has been fulfilled.
|
static int |
NOT_ACCEPTED
Indicates (value 1003) 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 int |
POLICY_VALIDATION
Indicates (value 1008) that an endpoint is terminating the connection because
it has received a message that violates its policy.
|
static int |
PROTOCOL_ERROR
Indicates (value 1002) that an endpoint is terminating the connection due to
a protocol error.
|
static int |
SERVICE_OVERLOAD
Indicates (value 1013) that the service is experiencing overload.
|
static int |
SERVICE_RESTART
Indicates (value 1012) that the service is restarted.
|
static int |
TLS_FAILURE
Reserved (value 1015) and MUST NOT be set as a status code in a Close control
frame by an endpoint.
|
static int |
TOO_BIG
Indicates (1009) that an endpoint is terminating the connection because it
has received a message that is too big for it to process.
|
static int |
UNEXPECTED_CONDITION
Indicates (value 1011) that a server is terminating the connection because it
encountered an unexpected condition that prevented it from fulfilling the
request.
|
Constructor and Description |
---|
CloseFrame()
Constructs an empty Web Socket connection close frame with all reserved bits
cleared.
|
CloseFrame(byte[] payload)
Constructs a Web Socket connection close frame with all reserved bits cleared.
|
CloseFrame(int status)
Constructs a Web Socket connection close frame with the specified status code
and with all reserved bits cleared.
|
CloseFrame(int rsvBits,
byte[] payload)
Constructs a Web Socket connection close frame.
|
CloseFrame(int rsvBits,
int status)
Constructs a Web Socket connection close frame with the specified status
code.
|
CloseFrame(int rsvBits,
int status,
String reason)
Constructs a Web Socket connection close frame with the specified status code
and reason text.
|
CloseFrame(int status,
String reason)
Constructs a Web Socket connection close frame with the specified status code,
reason text and with all reserved bit cleared.
|
Modifier and Type | Method and Description |
---|---|
String |
getReason()
Returns the closing reason text in this frame.
|
int |
getStatus()
Returns the closing status code in this frame.
|
getOpcode, getPayload, getPayloadLength, getRsvBits, isFinalFragment, isRsvBit1, isRsvBit2, isRsvBit3
public static final int NORMAL
public static final int GOING_AWAY
public static final int PROTOCOL_ERROR
public static final int NOT_ACCEPTED
public static final int NO_CODE
public static final int ABNORMAL
public static final int NON_UTF8
public static final int POLICY_VALIDATION
public static final int TOO_BIG
public static final int MISSED_EXTENSION
public static final int UNEXPECTED_CONDITION
public static final int SERVICE_RESTART
public static final int SERVICE_OVERLOAD
public static final int BAD_GATEWAY
public static final int TLS_FAILURE
public CloseFrame(int rsvBits, byte[] payload)
rsvBits
- reserved bits for extensions or future versionspayload
- payload dataIllegalArgumentException
- if the length of the payload data equals 1
or is greater than 125public CloseFrame(byte[] payload)
payload
- payload dataIllegalArgumentException
- if the length of the payload data equals 1
or is greater than 125public CloseFrame()
public CloseFrame(int rsvBits, int status)
rsvBits
- reserved bits for extensions or future versionsstatus
- the status codepublic CloseFrame(int status)
status
- the status codepublic CloseFrame(int rsvBits, int status, String reason)
rsvBits
- reserved bits for extensions or future versionsstatus
- the status codereason
- the reason textpublic CloseFrame(int status, String reason)
status
- the status codereason
- the reason textpublic int getStatus()
-1
if this frame is empty (no payload)public String getReason()
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.