Hey,
I've been trying to emulate parts of 3rd party library and stumbled
upon a problem. The library has certain classes with java.lang.Object
references that I wanted to get rid of, and I want the classes to
implement java.io.Serializable. The package structure is like that:
-java/dao/
-EntityWithObjectReference.java
-EntityWithObjectReference_CustomFieldSerializer.java
-ExtendedEntity.java
-resources/
serialization.gwt.xml
-substituted.dao/
EntityWithObjectReference.java
Everything is built using maven, so files end up where they should
be.
Original base entity class I want to emulate:
package dao;
public class EntityWithObjectReference {
public Object objReference;
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
Emulated base entity class (implements serializable, Object ref
removed):
package dao;
import java.io.Serializable;
public class EntityWithObjectReference implements Serializable {
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
The class I actually use in both client and server side:
package dao;
import java.io.Serializable;
public class ExtendedEntity extends EntityWithObjectReference
implements Serializable {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
There's also a EntityWithObjectReference_CustomFieldSerializer.java,
which simply ignores the Object reference for now:
package dao;
import com.google.gwt.user.client.rpc.*;
public class EntityWithObjectReference_CustomFieldSerializer {
public static void serialize(SerializationStreamWriter writer,
EntityWithObjectReference entity) throws SerializationException {
writer.writeString(entity.getText());
}
public static void deserialize(SerializationStreamReader reader,
EntityWithObjectReference entity) throws SerializationException {
entity.setText( reader.readString());
}
}
Now, if I just leave the source element empty (it should include all
the java files in the package), everything works fine, serialization
works as expected, and custom serializer is being called.
serialization.gwt.xml:
<module>
<inherits name="com.google.gwt.core.Core"/>
<source path="dao">
<!--include name="ExtendedEntity.java"/-->
<!--include name="EntityWithObjectReference.java"/-->
</source>
<super-source path="substituted"/>
</module>
***When I try to uncomment the two lines*** that explicitly include
the specific java files (I need that because the original library I
want to emulate has a number of additional files in the source
packages that gwt doesn't ever need to know about), there's a problem
- GWT keeps complaining that 'This application is out of date, please
click the refresh button on your browser'. The server response is the
same in both cases:
//OK[3,2,1,["dao.ExtendedEntity/1266011518","xxx","evil entity"],0,5]
But GWT generated javascript expects a different checksum in this
case, and an exception is raised when deserializing the data. Any
ideas why this is happening? Bug, feature, a bit of both? I'd be more
than happy to supply the code to verify this behavior, if anyone can
help me sort this out.
regards,
Andrius J.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---