Been loving the undertow project so far.
Background
I’m creating this request since I spent a great deal of time last night debugging a very hard-to-pin issue that ended up being caused by the following line of code...
https://github.com/undertow-io/undertow/blob/master/websockets-jsr/src/main/java/io/undertow/websockets/jsr/WebSocketSessionRemoteEndpoint.java#L268
For now, my solution is just to reverse the ‘clear’ by calling a flip. I may just write a wrapper for my ByteBuffers to lock consumers from fiddling with their read/write state, but from the tone of the code comment it sounds like the author was equally at a loss for why the JSR TCK is requiring your code to do that .clear() call as well.
In short
I'm requesting that an additional supplemental method be provided that allows consumers to send a bytebuffer without having to deal with the .clear() call it is mandating.
Psuedo code would be something like...
@Override public void sendBinary(final ByteBuffer data) throws IOException { sendBinaryNoClear(data); data.clear(); //for some reason the TCK expects this, might as well just match the RI behaviour } public void sendBinaryNoClear(final ByteBuffer data) throws IOException { if(data == null) { throw JsrWebSocketMessages.MESSAGES.messageInNull(); } assertNotInFragment(); WebSockets.sendBinaryBlocking(data, undertowSession.getWebSocketChannel()); }
Thank you for your time!