eclipse-ee4j / eclipse-ee4j/tyrus

Multiple text decoders

Open
#619 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
128
Forks
49
PR merge metrics
No merged PRs in 30d

Description

I seem to be getting `Text MessageHandler already registered` when trying to register multiple JSON decoders for multiple types of POJOs. Shouldn't it be possible to register multiple types of decoders for the same type, considering there is `Boolean willDecode(String)` method in `Decoder.Text` interface?
For example:
```java
void onOpen(Session session)
{
session.addMessageHandler(GatewayHello.class, this::onHello);
session.addMessageHandler(GatewayAck.class, this::onGatewayAck);
session.addMessageHandler(GatewayInvalid.class, this::onGatewayInvalid);
}

void onHello(GatewayHello request)
{

}
void onGatewayAck(GatewayAck request)
{

}
void onGatewayInvalid(GatewayInvalid request)
{

}
```
And in `@ClientEndpoint` annotation
```java
@ClientEndpoint(
decoders = {HelloDecoder.class, AckDecoder.class, InvalidDecoder.class}
)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.