Framedatapublic class CloseFrame extends ControlFrame
Framedata.Opcode| Modifier and Type | Field | Description |
|---|---|---|
static int |
ABNORMAL_CLOSE |
1006 is a reserved value and MUST NOT be set as a status code in a
Close control frame by an endpoint.
|
static int |
BAD_GATEWAY |
1014 indicates that the server was acting as a gateway or proxy and received an
invalid response from the upstream server.
|
static int |
BUGGYCLOSE |
The connection had a buggy close (this should not happen)
|
static int |
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 int |
FLASHPOLICY |
The connection was flushed and closed
|
static int |
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 int |
NEVER_CONNECTED |
The connection had never been established
|
static int |
NO_UTF8 |
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 int |
NOCODE |
1005 is a reserved value and MUST NOT be set as a status code in a
Close control frame by an endpoint.
|
static int |
NORMAL |
indicates a normal closure, meaning whatever purpose the
connection was established for has been fulfilled.
|
static int |
POLICY_VALIDATION |
1008 indicates that an endpoint is terminating the connection
because it has received a message that violates its policy.
|
static int |
PROTOCOL_ERROR |
1002 indicates that an endpoint is terminating the connection due
to a protocol error.
|
static int |
REFUSE |
1003 indicates that an endpoint is terminating the connection
because it has received a type of data it cannot accept (e.g.
|
static int |
SERVICE_RESTART |
1012 indicates that the service is restarted.
|
static int |
TLS_ERROR |
1015 is a reserved value and MUST NOT be set as a status code in a
Close control frame by an endpoint.
|
static int |
TOOBIG |
1009 indicates that an endpoint is terminating the connection
because it has received a message which is too big for it to
process.
|
static int |
TRY_AGAIN_LATER |
1013 indicates that the service is experiencing overload.
|
static int |
UNEXPECTED_CONDITION |
1011 indicates that a server is terminating the connection because
it encountered an unexpected condition that prevented it from
fulfilling the request.
|
| Constructor | Description |
|---|---|
CloseFrame() |
Constructor for a close frame
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
getCloseCode() |
Get the used close code
|
java.lang.String |
getMessage() |
Get the message that closeframe is containing
|
java.nio.ByteBuffer |
getPayloadData() |
The "Payload data" which was sent in this frame
|
void |
isValid() |
Check if the frame is valid due to specification
|
void |
setCode(int code) |
Set the close code for this close frame
|
void |
setPayload(java.nio.ByteBuffer payload) |
Set the payload of this frame to the provided payload
|
void |
setReason(java.lang.String reason) |
Set the close reason for this close frame
|
java.lang.String |
toString() |
public static final int NORMAL
public static final int GOING_AWAY
public static final int PROTOCOL_ERROR
public static final int REFUSE
public static final int NOCODE
public static final int ABNORMAL_CLOSE
public static final int NO_UTF8
public static final int POLICY_VALIDATION
public static final int TOOBIG
public static final int EXTENSION
public static final int UNEXPECTED_CONDITION
public static final int SERVICE_RESTART
public static final int TRY_AGAIN_LATER
public static final int BAD_GATEWAY
public static final int TLS_ERROR
public static final int NEVER_CONNECTED
public static final int BUGGYCLOSE
public static final int FLASHPOLICY
public CloseFrame()
Using opcode closing and fin = true
public void setCode(int code)
code - the close codepublic void setReason(java.lang.String reason)
reason - the reason codepublic int getCloseCode()
public java.lang.String getMessage()
public java.lang.String toString()
toString in class FramedataImpl1public void isValid()
throws InvalidDataException
FramedataImpl1isValid in class ControlFrameInvalidDataException - thrown if the frame is not a valid framepublic void setPayload(java.nio.ByteBuffer payload)
FramedataImpl1setPayload in class FramedataImpl1payload - the payload which is to setpublic java.nio.ByteBuffer getPayloadData()
FramedatagetPayloadData in interface FramedatagetPayloadData in class FramedataImpl1