We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When implementing a class like this:
public class UuidDecoder implements Decoder.TextStream<UUID>, Decoder, Decoder.Binary<UUID>, Decoder.Text<UUID> { public UuidDecoder() { System.out.println("OK!"); } @Override public void init(EndpointConfig config) { } @Override public void destroy() { } @Override public UUID decode(Reader reader) throws DecodeException, IOException { return UUID.fromString(CharStreams.toString(reader)); } @Override public UUID decode(ByteBuffer bytes) throws DecodeException { return UUID.fromString(new String(bytes.array())); } @Override public boolean willDecode(ByteBuffer bytes) { try { UUID.fromString(new String(bytes.array())); return true; } catch (IllegalArgumentException e) { return false; } } @Override public UUID decode(String s) throws DecodeException { return UUID.fromString(s); } @Override public boolean willDecode(String s) { try { UUID.fromString(s); return true; } catch (IllegalArgumentException e) { return false; } } }
And using it like this:
@ServerEndpoint(value = "/api/ws/search/{id}", decoders = UuidDecoder.class) public class SearchResource { }
Only the binary encoder/decoder is registered, since EncodingFactory checks for interface implementations using else-if.
EncodingFactory
See https://stackoverflow.com/questions/60134388/how-to-use-custom-encoder-and-decoder-in-quarkus
I'll submit a PR to fix this.
The text was updated successfully, but these errors were encountered:
Allow classes to implement multiple encoders/decoders
354b5b9
Fixes quarkusioGH-50
13994d0
Successfully merging a pull request may close this issue.
When implementing a class like this:
And using it like this:
Only the binary encoder/decoder is registered, since
EncodingFactory
checks for interface implementations using else-if.See https://stackoverflow.com/questions/60134388/how-to-use-custom-encoder-and-decoder-in-quarkus
I'll submit a PR to fix this.
The text was updated successfully, but these errors were encountered: