-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
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
Define that user provided encoders and decoders override the platform provided ones (e.g. for Integer-> String conversions) #213
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
|
Indeed. I think this is sufficiently obvious that we can clarify it in 2.0. I'll work on some updates. |
Ah. As I look into this it gets more complex. I'm using First of all The Return values are less obvious. If the method returns a Similar questions exist for The final part of the puzzle is the search order of annotations and configurations. See #289. I mention that here for completeness but I think it can be handled in that issue. For this issue I am currently thinking that a registered Encoder always takes priority when determining how to handle a message. This allows developers to override the default container provided handling for any primitive or object. My thinking is that this is the logical extension of what we already have for Whatever we decide for this will have implications for the specification document, Javadoc and the TCK so this is definitely a Jakarta EE 10 issue. |
I really wish this spec never had Encoders and Decoders. I've always interpreted the spec as the implementation always having primitive encoders as default implementations.
Then when a Endpoint is registered, the declared Encoders replace the previous set for the same type. The use of |
In fact, wouldn't it be swell to just have each of the primitive encoders and decoders declared in the websocket API and ask the implementations to use them? That way the other vague pieces about supporting primitives could be standardized as well (such as how many decimal places do we support in double or float, what does a "byte" look like in text form? what about out of bands usage for that format?) |
I like this idea. It is simple and clear. |
Can someone elaborate on parts of this issue post as I don't quite follow it.
How is this different from the new current spec? The primitive would be autoboxed via the sendObject(Object data) call, so wouldn't the custom encoder be picked first?
Once again, wouldn't the custom encoder be used first (assuming the class type is applicable) before the platform encoder, per spec? The 2.1 javadoc for As for the other comments: Thanks! |
|
Have you filed this as a bug at Tomcat? |
I have not. Before I do, let me ask @markt-asf. Would this be considered a bug -- looks like it's been this way for 10 years? Looked at this more, and I don't see decoders registered for primitives or Strings (decoders only added when nothing else has a match) |
Jetty doesn't add the Primitive decoders to the decoder list on the either the EndpointConfig.decoders or the ServerEndpointConfig.decoders Those are used internally, when nothing else will handle the object. |
Otherwise, what would be the point ?
For encoders, the javadoc on the RemoteEndpoint send operations does define the override for primitive types, but doesn't mention String-> String encoders which should be allowed.
For decoders, there isn't anything, so currently its undefined.
Affected Versions
[1.0]
The text was updated successfully, but these errors were encountered: