You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2013/10/12 00:05:44 UTC
svn commit: r1531446 -
/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java
Author: gawor
Date: Fri Oct 11 22:05:44 2013
New Revision: 1531446
URL: http://svn.apache.org/r1531446
Log:
GERONIMO-6505: CloseReason.CloseCodes enum's getCode method always returns 1111. Patch from Andy McCright.
Modified:
geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java
Modified: geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java?rev=1531446&r1=1531445&r2=1531446&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java (original)
+++ geronimo/specs/trunk/geronimo-websockets_1.0_spec/src/main/java/javax/websocket/CloseReason.java Fri Oct 11 22:05:44 2013
@@ -44,81 +44,87 @@ public class CloseReason {
* 1000 indicates a normal closure, meaning that the purpose for which the connection was established has been
* fulfilled.
*/
- NORMAL_CLOSURE, // 1000
+ NORMAL_CLOSURE (1000),
/**
* 1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated
* away from a page.
*/
- GOING_AWAY, // 1001
+ GOING_AWAY (1001),
/**
* 1002 indicates that an endpoint is terminating the connection due to a protocol error.
*/
- PROTOCOL_ERROR, // 1002
+ PROTOCOL_ERROR (1002),
/**
* 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).
*/
- CANNOT_ACCEPT, // 1003
+ CANNOT_ACCEPT (1003),
/**
* Reserved. The specific meaning might be defined in the future.
*/
- RESERVED, // ? treated as 1004
+ RESERVED (1004),
/**
* 1005 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is
* designated for use in applications expecting a status code to indicate that no status code was actually
* present.
*/
- NO_STATUS_CODE, // 1005
+ NO_STATUS_CODE (1005),
/**
* 1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is
* designated for use in applications expecting a status code to indicate that the connection was closed
* abnormally, e.g., without sending or receiving a Close control frame.
*/
- CLOSED_ABNORMALLY, // 1006
+ CLOSED_ABNORMALLY (1006),
/**
* 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 data within a text message).
*/
- NOT_CONSISTENT, // 1007
+ NOT_CONSISTENT (1007),
/**
* 1008 indicates that an endpoint is terminating the connection because it has received a message that violates
* its policy. This is a generic status code that can be returned when there is no other more suitable status
* code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy.
*/
- VIOLATED_POLICY, // 1008
+ VIOLATED_POLICY (1008),
/**
* 1009 indicates that an endpoint is terminating the connection because it has received a message that is too
* big for it to process.
*/
- TOO_BIG, // 1009
+ TOO_BIG (1009),
/**
* 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. The list of extensions that are needed SHOULD appear in the /reason/ part of the Close frame. Note
* that this status code is not used by the server, because it can fail the WebSocket handshake instead.
*/
- NO_EXTENSION, // 1010
+ NO_EXTENSION (1010),
/**
* 1011 indicates that a server is terminating the connection because it encountered an unexpected condition
* that prevented it from fulfilling the request.
*/
- UNEXPECTED_CONDITION, // 1011
+ UNEXPECTED_CONDITION (1011),
/**
* 1012 indicates that the service will be restarted.
*/
- SERVICE_RESTART, // 1012
+ SERVICE_RESTART (1012),
/**
* 1013 indicates that the service is experiencing overload
*/
- TRY_AGAIN_LATER, // 1013
+ TRY_AGAIN_LATER (1013),
/**
* 1015 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is
* designated for use in applications expecting a status code to indicate that the connection was closed due to
* a failure to perform a TLS handshake (e.g., the server certificate can't be verified).
*/
- TLS_HANDSHAKE_FAILURE; // 1015
+ TLS_HANDSHAKE_FAILURE (1015);
+
+ private int code;
+
+ CloseCodes (int code) {
+ this.code = code;
+ }
/**
* Return the code number of this status code.
@@ -127,8 +133,7 @@ public class CloseReason {
*/
@Override
public int getCode() {
- // TODO This method makes no sense in this context....
- return 1111;
+ return this.code;
}
/**