Hi,
2016-12-13 20:41 GMT+02:00 Romain Manni-Bucau <[email protected]>:
>
> Hi guys,
>
> is it under radar lambdas don't work with websocket programmatic API?
>
> session.addMessageHandler(new MessageHandler.Whole<Request>() {
> @Override
> public void onMessage(final Request request) {
> *// whatever*
> }
> });
>
>
> If you convert it in a lambda ((MessageHandler.Whole<Request>) m -> {})
> then tomcat is not able to extract the type. There are several solution on
> the net I think about it so I guess it should be doable?
>
This is working for me
Instead of:
session.addMessageHandler(new MessageHandler.Whole<String>() {
@Override
public void onMessage(String message) {
*// whatever*
}
});
this one:
session.addMessageHandler(String.class, message -> {
*// whatever*
});
Regards,
Violeta
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>