GWT Deserialize Generics List in RPC Call
I have a method that returns a list of serializable objects, I make an RPC call to this method and everything went well until the deserialization process: I received the following message: "The response could not be deserialized"
Note: Here is my gwt-rpc response string:
/ / OK [0,2768,3,2,0,2764,3,2,0,2761,3,2,0,2754,3,2,0,2750 , 3,2,0,2610,3,2,0,2606,3,2,0,2603,3,2,0,2600,3,2,9,1 ["java.util.ArrayList/3821开发者_如何学C976829 "" myPackage.MyEntity/845101117 "," java.lang.Integer/3438268394 "], 0.7]
DTO
public class MyEntity implements Serializable,IsSerializable
{
private static final long serialVersionUID = -9032157988566853424L;
public MyEntity ()
{
super();
}
private Integer _entityId;
private String _name;
public Integer getEntityId()
{
return _entityId;
}
public void setEntityId(Integer entityId)
{
this._entityId = entityId;
}
public String getName()
{
return _name;
}
public void setName(String _name)
{
this._name = _name;
}
}
Interfaces
@RemoteServiceRelativePath("ContributorService.rpc")
public interface ContributorService extends RemoteService
{
ArrayList<MyEntity> myMethod(Arg arg);
}
public interface ContributorServiceAsync
{
void myMethod(Arg arg, AsyncCallback<ArrayList<MyEntity>> callback);
}
Server Implementation:
@SuppressWarnings("serial")
public class ContributorServiceImpl extends RemoteServiceServlet implements ContributorService
{
@Override
public ArrayList<MyEntity> myMethod(Arg arg)
{
ArrayList<MyEntity> myList = new ArrayList<MyEntity>();
MyEntity myEntity=new MyEntity();
//code...
myList .add(myEntity);
return myList;
}
}
Thanks for your help
Thank you to everyone for the help it was a stupid mistake that I still can not understand. I changed GWT sdk and the program worked, then I used the old SDK to ensure that the problem emanates from the sdk but the surprise the program still works ':(
I understand nothing of what is past but the more important that my application works :)
精彩评论