Package org.eclipse.jetty.websocket.core
Class CloseStatus
java.lang.Object
org.eclipse.jetty.websocket.core.CloseStatus
Representation of a WebSocket Close (status code & reason)
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final CloseStatus
static final int
static final CloseStatus
static final int
static final CloseStatus
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionCreates a reason for closing a web socket connection with the no given status code.CloseStatus
(int statusCode) Creates a reason for closing a web socket connection with the given status code and no reason phrase.CloseStatus
(int statusCode, String reasonPhrase) Creates a reason for closing a web socket connection with the given status code and reason phrase.CloseStatus
(int statusCode, String reasonPhrase, Throwable cause) Creates a reason for closing a web socket connection with the given status code and reason phrase.CloseStatus
(int statusCode, Throwable cause) Creates a reason for closing a web socket connection with the given status code and reason phrase.CloseStatus
(ByteBuffer payload) CloseStatus
(Frame frame) -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBuffer
asPayloadBuffer
(int statusCode, String reason) static String
codeString
(int closeStatus) getCause()
static CloseStatus
getCloseStatus
(Frame frame) int
getCode()
boolean
boolean
isNormal()
static boolean
isOrdinary
(int closeCode) static boolean
isTransmittableStatusCode
(int statusCode) Test if provided status code can be sent/received on a WebSocket close.toFrame()
static Frame
toFrame
(int closeStatus) static Frame
toString()
-
Field Details
-
NORMAL
public static final int NORMAL- See Also:
-
SHUTDOWN
public static final int SHUTDOWN- See Also:
-
PROTOCOL
public static final int PROTOCOL- See Also:
-
BAD_DATA
public static final int BAD_DATA- See Also:
-
RESERVED
public static final int RESERVED- See Also:
-
NO_CODE
public static final int NO_CODE- See Also:
-
NO_CLOSE
public static final int NO_CLOSE- See Also:
-
BAD_PAYLOAD
public static final int BAD_PAYLOAD- See Also:
-
POLICY_VIOLATION
public static final int POLICY_VIOLATION- See Also:
-
MESSAGE_TOO_LARGE
public static final int MESSAGE_TOO_LARGE- See Also:
-
EXTENSION_ERROR
public static final int EXTENSION_ERROR- See Also:
-
SERVER_ERROR
public static final int SERVER_ERROR- See Also:
-
SERVICE_RESTART
public static final int SERVICE_RESTART- See Also:
-
TRY_AGAIN_LATER
public static final int TRY_AGAIN_LATER- See Also:
-
BAD_GATEWAY
public static final int BAD_GATEWAY- See Also:
-
FAILED_TLS_HANDSHAKE
public static final int FAILED_TLS_HANDSHAKE- See Also:
-
NO_CODE_STATUS
-
NO_CLOSE_STATUS
-
NORMAL_STATUS
-
-
Constructor Details
-
CloseStatus
public CloseStatus()Creates a reason for closing a web socket connection with the no given status code. -
CloseStatus
public CloseStatus(int statusCode) Creates a reason for closing a web socket connection with the given status code and no reason phrase.- Parameters:
statusCode
- the close code
-
CloseStatus
Creates a reason for closing a web socket connection with the given status code and reason phrase.- Parameters:
statusCode
- the close codereasonPhrase
- the reason phrase
-
CloseStatus
Creates a reason for closing a web socket connection with the given status code and reason phrase.- Parameters:
statusCode
- the close codecause
- the error which caused the close
-
CloseStatus
Creates a reason for closing a web socket connection with the given status code and reason phrase.- Parameters:
statusCode
- the close codereasonPhrase
- the reason phrasecause
- the error which caused the close
-
CloseStatus
-
CloseStatus
-
-
Method Details
-
getCloseStatus
-
isOrdinary
public static boolean isOrdinary(int closeCode) -
isAbnormal
public boolean isAbnormal() -
getCause
-
getCode
public int getCode() -
getReason
-
asPayloadBuffer
-
asPayloadBuffer
-
isTransmittableStatusCode
public static boolean isTransmittableStatusCode(int statusCode) Test if provided status code can be sent/received on a WebSocket close.This honors the RFC6455 rules and IANA rules.
- Parameters:
statusCode
- the statusCode to test- Returns:
- true if transmittable
-
toFrame
-
toFrame
-
toFrame
-
codeString
-
isNormal
public boolean isNormal() -
toString
-