jsr356-experts@websocket-spec.java.net

[jsr356-experts] Re: [jsr356-users] RemoteEndpoint.sendObject()

From: Danny Coward <danny.coward_at_oracle.com>
Date: Thu, 07 Feb 2013 17:37:51 -0800

Hi Mark,

Thanks for bringing this up. I hadn't looked at this part of the API for
a while and I think there are a few corrections to make.

On 2/7/13 7:09 AM, Mark Thomas wrote:
> Just looking at implementing this and there very little information on
> what is meant to happen.
>
> Am I correct in assuming that the Object is meant to be converted to a
> String and sent as a text message?
>
> If yes, how is the conversion performed?
0. If developer object, get the first Encoder in the list that will
handle it.

> 1. If primitive convert to Object.
> 2. Object.toString()
Yes. I *think* the Java class equivalents of primitives have a
well-defined toString() ?
>
> What about arrays? toString() isn't going to work.
Yes. Sorry. I think arrays and collections need to be removed. At one
point we were looking for some equivalence with JAX-RS which does this
(presumably they have their own collection encoding/decoding scheme),
which is I think why it lingered there.

>
> How ever this conversion occurs, it needs to be consistent across
> implementations and I can't find enough information in the specification
> or Javadoc to determine what the behaviour should be.
>
>
> A second question is how, if at all, does this relate to having
> annotations like:
>
> @WebSocketMessage
> onMessage(long foo) {
> ...
> }
>
> The discussion on WEBSOCKET_SPEC-96 covers primitives and Object
> equivalents but not arrays. It seems odd that this is not symmetrical
> between send and receive.
I think if we remove the arrays and collections it will be ?

- Danny
>
> Mark


-- 
<http://www.oracle.com> 	*Danny Coward *
Java EE
Oracle Corporation