What’s new?

Maven archetype was (finally) added, so if you want to generate simple application, test it and maybe start playing with the code and modifying it to something more complex, you can. All you need is maven and little space on your hard drive. Then you can execute following command:

Close reason for dropped connection is now 1006, as it should be.

Standalone Server is not leaking daemon threads any more.

Java SE 8 runtime issues.

Internal InputStream implementation now correctly returns ‘-1′ to InputStream#read() only when end of input is reached. Thanks Raghu for contributing the fix!

Java SE 8 related issue is worth a short explanation, since the change introduced by this fix goes beyond SE 8. Original problem was about some bug in Java SE 7 which somehow corrected Tyrus behaviour, so it was not noticed by our tests – bridge methods are not returned from Class.getMethods() call there. This was fixed in Java SE 8 and it caused some troubles in Tyrus implementation, because we just did not expect them to be returned.

The other part of this issue was correcting Tyrus in terms of handling inherited methods. JSR 356 describes how these should be handled in little bit cryptic way, but it basically states that annotations are not inherited, which is already defined in Java language specification. Unfortunately, Tyrus prior this version was considering annotated methods (@OnOpen, @OnMessage, …) only from the very same class as the registered one, so inherited methods were always ignored. This is now changed, so you can have something like:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

publicclassBaseEndpoint {

@OnOpen

publicvoidonOpen(Session session) throwsIOException {

// do something.

}

}

@ServerEndpoint("/echo")

publicclassEchoEndpoint extendsBaseEndpoint {

@OnMessage

publicvoidecho(Session session, String message) throwsIOException {

// do something else.

}

}

both methods – onOpen and onMessage will be considered as part of EchoEndpoint class. Please note that annotations are still not inherited, so if you for example declare BaseEndpoint class as abstract with onOpen method annotated with @OnOpen, overriding method won’t be called by Tyrus unless you “re-add” @OnOpen annotation to new method:

1

2

3

4

5

6

7

8

9

10

11

12

13

publicabstractclassBaseEndpoint {

publicabstractvoidonOpen(Session session) throwsIOException;

}

@ServerEndpoint("/echo")

publicclassEchoEndpoint extendsBaseEndpoint {

@OnOpen// this has to be here!

@Override

publicvoidonOpen(Session session) throwsIOException {

// do something.

}

}

Feel free to ask here or send us a note to users@tyrus.java.net if you have any questions related to this release or anything related to our WebSocket implementation.