Tyrus 1.8
- by Pavel Bucek
Another version of Tyrus, the reference implementation of JSR 356 – Java API for WebSocket is out! Complete list of fixes and features is below, but let me describe some of the new features in more detail. All information presented here is also available in Tyrusdocumentation.
What’s new?
First to mention is that JSR 356 Maintenance review Ballot is over and the change proposed for 1.1 release was accepted. More details about changes in the API can be found in this article. Important part is that Tyrus 1.8 implements this API, meaning you can use Lambda expressions and some features of Nashorn without the need for any workarounds.
Almost all other features are related to client side support, which was significantly improved in this release. Firstly – I have to admit, that Tyrus client contained security issue – SSL Hostname verification was not performed when connecting to “wss” endpoints. This was fixed as part of TYRUS-339 and resulted in some changes in the client configuration API. Now you can control whether HostnameVerification should be performed (SslEngineConfigurator#setHostnameVerificationEnabled(boolean)) or even set your own HostnameVerifier (please use carefully): #setHostnameVerifier(…). Detailed description can be found in Host verification chapter.
Another related enhancement is support for Http Basic and Digest authentication schemes. Tyrus client now enables users to provide credentials and underlying implementation will take care of everything else. Our implementation is strictly non pre-emptive, so the login information is sent always as a response to 401 Http Status Code. If the Basic and Digest are not good enough and there is a need to use some custom scheme or something which is not yet supported in Tyrus, custom Authenticator can be registered and the authentication part of the handshake process will be handled by it. Please seeClient HTTP Authentication chapter in the user guide for more details.
There are other features, like fine-grain threadpool configuration for JDK client container, build-in Http redirect support and some reshuffling related to unifying the location of client configuration classes and properties definition – every property should be now part of ClientProperties class. All new features are described in the user guide – in chapterTyrus proprietary configuration.
Update – Tyrus 1.8.1
There was another slightly late reported issue related to running in environments with SecurityManager enabled, so this version fixes that. Another noteworthy fixes are TYRUS-355 and TYRUS-361; the first one is about incorrect thread factory used for shared container timeout, which resulted in JVM waiting for that thread and not exiting as it should. The other issue enables relative URIs in Location header when using redirect feature.
Links
Tyrus homepage
mailing list
JIRA
Complete list of changes:
Bug
[TYRUS-333] – Multiple endpoints on one client
[TYRUS-334] – When connection is closed by a peer, periodic heartbeat pong is not stopped
[TYRUS-336] – ReaderBuffer.getNextChars() keeps blocking a server thread after client has closed the session
[TYRUS-338] – JDK client SSL filter needs better synchronization during handshake phase
[TYRUS-339] – SSL hostname verification is missing
[TYRUS-340] – Test PathParamTest are not stable with JDK client
[TYRUS-341] – A control frame inside a stream of continuation frames is treated as the part of the stream
[TYRUS-343] – ControlFrameInDataStreamTest does not pass on GF
[TYRUS-345] – NPE is thrown, when shared container timeout property in JDK client is not set
[TYRUS-346] – IllegalStateException is thrown, when using proxy in JDK client
[TYRUS-347] – Introduce better synchronization in JDK client thread pool
[TYRUS-348] – When a client and server close connection simultaneously, JDK client throws NPE
[TYRUS-356] – Tyrus cannot determine the connection port for a wss URL
[TYRUS-357] – Exception thrown in MessageHandler#OnMessage is not caught in @OnError method
[TYRUS-359] – Client based on Java 7 Asynchronous IO makes application unexitable
Improvement
[TYRUS-328] – JDK 1.7 AIO Client container – threads – (setting threadpool, limits, …)
[TYRUS-332] – Consolidate shared client properties into one file.
[TYRUS-337] – Create an SSL version of Basic Servlet test
New Feature
[TYRUS-228] – Add client support for HTTP Basic/Digest
Task
[TYRUS-330] – create/run tests/servlet/basic via wss
[TYRUS-335] – [clustering] – introduce RemoteSession and expose them via separate method (not include remote sessions in the getOpenSessions())
[TYRUS-344] – Introduce Client support for HTTP Redirect