+ Fixing onOpen context classloader to be that of the context
that started the WebSocketUpgradeFilter (which will be the
same as the WebAppContext in most cases)
* Using Servlet 3.1's ServletContext.addFilter() mechanisms with its
FilterRegistration to encourage the WebSocketUpgradeFilter to be
first in the filter chain.
Note: this is possible, but can be overridden by another call
to the same ServletContext.addFilter() using the same techniques
to put something in front of the WebSocketUpgradeFilter.
+ Improved test case handling of frame reading (to prevent future
false failures)
+ Improved AbstractWebSocketConnection handling of close -> disconnect
to only trigger on successful write (or failure) of close frame flush
attempt.
+ Flusher close on all forms of disconnect, even half-closed.
+ Fixing bad assumptions in unit tests where the client would send a few
frames to test the protocol behavior followed by the close frame.
But the test expected the server to initiate the close, but this setup
of the tests would mean that the client initiated the close.
Introduced the automatic batch mode, akin to Jetty 8's WebSocket
implementation.
Now, if there are no more frames to process, and the previous frames
have been aggregated, FrameFlusher auto-flushes the aggregated frames.
This simplifies applications because they don't need to call flush()
explicitly.
Refactored FrameFlusher to handle aggregation of frames to support
JSR 356's batch mode.
Now FrameFlusher can aggregate frames as long as the FlushMode they
were sent is AUTO. When a frame that has FlushMode SEND arrives,
it will trigger the flush of the aggregate buffer (and eventually
also other queued frames).
A special BINARY frame is used to implement explicit flush()
invocations.
The problem was that UpgradeResponse was setting the subProtocol as a
header, and HandshakeRFC6455 was extracting it and *adding* it again.
Fixed by removing the code in HandshakeRFC6455.
Fixed by having the Parser release the payload ByteBuffer.
Also reworked WebSocketFrame.reset() method, and made sure
that outgoing frames also don't leak ByteBuffers.
Introduced ServletUpgradeResponse.complete(), called when the response
is about to be sent to the client, to transfer the headers stored in
the superclass (UpgradeResponse.headers) into the HttpServletResponse.