RFR JDK-8156650: Simplify Text message support in WebSocket API

Pavel Rappo pavel.rappo at oracle.com
Thu Jun 2 18:07:00 UTC 2016


Hi,

Could you please review the following change for JDK-8156650?

http://cr.openjdk.java.net/~prappo/8156650/webrev.01/

This change addresses some WebSocket API refinements and enhancements from [1].

1. Remove method `WebSocket#sendText(ByteBuffer message, boolean isLast)`

This API sees Text messages as CharSequence(s), and Binary messages as
ByteBuffer(s). Providing more views on Text data is not necessary and unnatural.

2. Remove type `WebSocket.Text`

Both this type and the method above have been introduced to the API based on the
assumption that users will often need to treat text messages as bytes and that
encoding/decoding is a very expensive procedure. These assumptions were
incorrect.

3. Provide validity guarantees and requirements for CharSequence(s)

Require outgoing text to be well-formed, guarantee the same for incoming text.

Thanks,
-Pavel

--------------------------------------------------------------------------------
[1] https://bugs.openjdk.java.net/browse/JDK-8155621



More information about the net-dev mailing list