Based on my own experience of working with collections in GWTs RPC
mechanism, I can suggest you to create a POJO (Plain Old Java Object)
file in the *.shared package of your application, where you have to
declare all possible combinations of types (arrays of them) that you
are going to send to the server ( actually which you are going to
serialize ). For Example:
import java.io.Serializable;
import java.util.HashMap;
import java.util.ArrayList;
import java.utils.LinkedList;

Class DummyRPCData implements Serializable{

HashMap<String, String>[] foo1;
HashMap<String, ArrayList<String>>[] foo2;
HashMap<String, LinkedList<String>>[] foo3;
HashMap<String, List<String>>[] foo4;
......
......
......
HashMap<String, Boolean>[] fooN;
 public Serializable[] fix025;


public DummyPRCData() {
    foo1 = null;
    foo2 = null;
    ....
    ....
    ....
    fooN = null;
}

}

You also will be able to use just Serializable identifier in your
client side-code instead of defining the particular type at any
particular place, for example:
instead of:
    HashMap<String, String> map = new HashMap<String, String>();
    map.put("KEY", "VALUE");
you can write the following:
    HashMap<String, Serializable> map = new HashMap<String,
Serializable>();
    map.put("KEY", "VALUE");
But flexibility comes up not in the case of String type, but, when you
want to declare a hashmap of types String, and some triky
LinkedList<HashMap<Sttrig...... . In this case you just can write:

    HashMap<String, Serializable> map = new HashMap<String,
Serializable>();
    LinkedList<HashMap<String, Serializable>> list = new
LinkedList<HashMap<String, Serializable>>();
    map.put("KEY", list);
    //and then send map to the server.

I home my post is quite clear.

P.S.: The main idea is to declare all the types you are going to send
to the server.

On Mar 25, 6:59 pm, richip <ric...@gmail.com> wrote:
> I've an object which contains a HashMap<Long, Object> instance. I'm
> finding that when I put a value of type ArrayList, RPC calls fail with
> a SerializationException that starts with:
>
> com.google.gwt.user.client.rpc.SerializationException
>         at
> com.google.gwt.user.client.rpc.impl.SerializerBase.getTypeHandler(SerializerBase.java:
> 148)
> ...
>
> Any ideas why and suggestions on what to do to get to my intended
> process?

-- 
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-toolkit@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