Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
None
Description
Steps to reproduce:
1) Create two classes (POJOs): ClassA and ClassB with ClassB being a subclass of ClassA so ClassB extends ClassA.
2) Create an encoder for ClassA so that:
ClassAEncoder implements Encoder.Text<ClassA>
3) Specify this encoder on your @ServerEndpoint so that:
@ServerEndpoint(......., encoders =
,....)
4) Now try to send an instance of ClassB like:
ClassB classBInstance = new ClassB();
session.getBasicRemote().sendObject(classBInstance);
You should get the following exception:
"...javax.websocket.EncodeException: No suitable encoder found"
If you create an Encoder for ClassB then obviously everything is working fine..
The specification doesn't seem to say much about inheritance support in Encoders so I'm assuming implementations have the freedom to either support this or not?