kriswpl wrote:
> Interface method is:
> public Map<String, Object> test();
>
> and in implementation I put into returned map, object java.util.Long
> (which is serializable:) ):
> map.put("long", new Long(1));
>
> Where do I do it wrong?
>
>   
GWT does a great job of putting as little into the javascript as
possible. In the above case, there's nothing to tell it that you're
going to send a Long, so it doesn't generate the RPC code into the
javascript that knows how to deserialize a Long. Add another method that
references Long, and then your first method might work because the Long
code is now going to be included.

On a related note, using Map in the API is not a good idea because it
means GWT must look through all your code for every implementation of
Map to see whether it's used. At the very least, it will make compiles
take longer. At worst, it will generate longer code. It goes against the
grain for java programming, but you need to make GWT RPC APIs as
specific as possible. That means declaring that you're returning a
HashMap, not a Map, in the interface.

This also means you can't declare Object as a type in an RPC interface.


Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to