public class CloseFrame extends ControlFrame
Framedata.Opcode
限定符和类型 | 字段和说明 |
---|---|
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 |
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 |
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 |
UNEXPECTED_CONDITION
1011 indicates that a server is terminating the connection because
it encountered an unexpected condition that prevented it from
fulfilling the request.
|
构造器和说明 |
---|
CloseFrame()
Constructor for a close frame
Using opcode closing and fin = true
|
限定符和类型 | 方法和说明 |
---|---|
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() |
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 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
在类中 FramedataImpl1
public void isValid() throws InvalidDataException
FramedataImpl1
isValid
在类中 ControlFrame
InvalidDataException
- thrown if the frame is not a valid framepublic void setPayload(java.nio.ByteBuffer payload)
FramedataImpl1
setPayload
在类中 FramedataImpl1
payload
- the payload which is to setpublic java.nio.ByteBuffer getPayloadData()
Framedata
getPayloadData
在接口中 Framedata
getPayloadData
在类中 FramedataImpl1