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

Roger Riggs Roger.Riggs at Oracle.com
Mon Jun 6 15:34:35 UTC 2016


Hi Pavel,

Removing the Text interface and its complexity is a good simplification.

+1

Editorial:

WebSocket.java: 378/379 could be improved:

"This implementation passes only complete UTF-16 sequences to the {@code 
onText} method."

Roger


On 6/2/2016 2:07 PM, Pavel Rappo wrote:
> 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