Package org.simpleframework.http.socket
Enum CloseCode
- java.lang.Object
-
- java.lang.Enum<CloseCode>
-
- org.simpleframework.http.socket.CloseCode
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<CloseCode>
public enum CloseCode extends java.lang.Enum<CloseCode>
TheCloseCode
enumerates the closure codes specified in RFC 6455. When closing an established connection an endpoint may indicate a reason for closure. The interpretation of this reason by an endpoint, and the action an endpoint should take given this reason, are left undefined by RFC 6455. The specification defines a set of status codes and specifies which ranges may be used by extensions, frameworks, and end applications. The status code and any associated textual message are optional components of a Close frame.- Author:
- niall.gallagher
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ABNORMAL_CLOSURE
Indicates an abnormal closure and should not be used.GOING_AWAY
Indicates that the server is going down or the client browsed away.INTERNAL_SERVER_ERROR
Indicates an unexpected error within the server.INVALID_FRAME_DATA
Indicates that a payload was not consistent with the message type.NO_EXTENSION
Indicates that the server did not negotiate an extension properly.NO_STATUS_CODE
Indicates that no status code was present and should not be used.NORMAL_CLOSURE
Indicates the purpose for the connection has been fulfilled.POLICY_VIOLATION
Indicates an endpoint received a message that violates its policy.PROTOCOL_ERROR
Indicates the connection is terminating due to a protocol error.RESERVED
According to RFC 6455 this has been reserved for future use.TLS_HANDSHAKE_FAILURE
Indicates a validation failure for TLS and should not be used.TOO_BIG
Indicates that a payload is too big to be processed.UNSUPPORTED_DATA
Indicates the connection received a data type it cannot accept.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getData()
This is the data that represents the closure code.static CloseCode
resolveCode(int high, int low)
static CloseCode
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static CloseCode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NORMAL_CLOSURE
public static final CloseCode NORMAL_CLOSURE
Indicates the purpose for the connection has been fulfilled.
-
GOING_AWAY
public static final CloseCode GOING_AWAY
Indicates that the server is going down or the client browsed away.
-
PROTOCOL_ERROR
public static final CloseCode PROTOCOL_ERROR
Indicates the connection is terminating due to a protocol error.
-
UNSUPPORTED_DATA
public static final CloseCode UNSUPPORTED_DATA
Indicates the connection received a data type it cannot accept.
-
RESERVED
public static final CloseCode RESERVED
According to RFC 6455 this has been reserved for future use.
-
NO_STATUS_CODE
public static final CloseCode NO_STATUS_CODE
Indicates that no status code was present and should not be used.
-
ABNORMAL_CLOSURE
public static final CloseCode ABNORMAL_CLOSURE
Indicates an abnormal closure and should not be used.
-
INVALID_FRAME_DATA
public static final CloseCode INVALID_FRAME_DATA
Indicates that a payload was not consistent with the message type.
-
POLICY_VIOLATION
public static final CloseCode POLICY_VIOLATION
Indicates an endpoint received a message that violates its policy.
-
TOO_BIG
public static final CloseCode TOO_BIG
Indicates that a payload is too big to be processed.
-
NO_EXTENSION
public static final CloseCode NO_EXTENSION
Indicates that the server did not negotiate an extension properly.
-
INTERNAL_SERVER_ERROR
public static final CloseCode INTERNAL_SERVER_ERROR
Indicates an unexpected error within the server.
-
TLS_HANDSHAKE_FAILURE
public static final CloseCode TLS_HANDSHAKE_FAILURE
Indicates a validation failure for TLS and should not be used.
-
-
Method Detail
-
values
public static CloseCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CloseCode c : CloseCode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CloseCode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getData
public byte[] getData()
This is the data that represents the closure code. The array contains the high order byte and the low order byte as taken from the pre-defined closure code.- Returns:
- a byte array representing the closure code
-
resolveCode
public static CloseCode resolveCode(int high, int low)
-
-