public class CloseFrame extends ControlFrame
Modifier and Type | Field and 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. an endpoint that understands only text data MAY send this if it
receives a binary message).
|
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 and Description |
---|
CloseFrame()
Constructor for a close frame
Using opcode closing and fin = true
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
getCloseCode()
Get the used close code
|
String |
getMessage()
Get the message that closeframe is containing
|
ByteBuffer |
getPayloadData()
The "Payload data" which was sent in this frame
|
int |
hashCode() |
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(ByteBuffer payload)
Set the payload of this frame to the provided payload
|
void |
setReason(String reason)
Set the close reason for this close frame
|
String |
toString() |
append, get, getOpcode, getTransfereMasked, isFin, isRSV1, isRSV2, isRSV3, setFin, setRSV1, setRSV2, setRSV3, setTransferemasked
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(String reason)
reason
- the reason codepublic int getCloseCode()
public String getMessage()
public String toString()
toString
in class FramedataImpl1
public void isValid() throws InvalidDataException
FramedataImpl1
isValid
in class ControlFrame
InvalidDataException
- thrown if the frame is not a valid framepublic void setPayload(ByteBuffer payload)
FramedataImpl1
setPayload
in class FramedataImpl1
payload
- the payload which is to setpublic ByteBuffer getPayloadData()
Framedata
getPayloadData
in interface Framedata
getPayloadData
in class FramedataImpl1
public boolean equals(Object o)
equals
in class FramedataImpl1
public int hashCode()
hashCode
in class FramedataImpl1
Copyright © 2021. All rights reserved.