Hello, 

    I am working on some code that will do serialization on a 
canvas(SmartGWT canvas)  so that it could be saved to the server in a 
database, I found some example code that I am using on how to do 
serialization in GWT but i keep getting the following error: 
[ERROR] [web_final] - Line 22: No source code is available for type 
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter; did 
you forget to inherit a required module?
[ERROR] [web_final] - Line 46: No source code is available for type 
com.google.gwt.user.server.rpc.SerializationPolicy; did you forget to 
inherit a required module?

and here is the code that is generating it: 

import com.google.gwt.core.client.GWT;

import com.google.gwt.user.client.rpc.SerializationException;

import com.google.gwt.user.client.rpc.SerializationStreamFactory;

import com.google.gwt.user.server.rpc.SerializationPolicy;

import com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter;

import com.smartgwt.client.widgets.Canvas;

public class CanvasSerialize{

    public CanvasSerialize() {}    

    public String doSerialize(Canvas canvasIn){

        Class<?> responseClass = canvasIn.getClass();

        // make a serialization policy of my own to use, normally 
deteremined by rpc request

        ServerSerializationStreamWriter stream = 
newServerSerializationStreamWriter(
new SerializePolicy());

        stream.prepareToWrite();

        if (responseClass != void.class) {

         try {

                stream.serializeValue(canvasIn, responseClass);

                } catch (SerializationException e) {e.printStackTrace();}

        }

        String bufferStr = stream.toString();

        return bufferStr;

    }

    public Canvas deSerialize(String buffer){

     SerializationStreamFactory ssf = GWT.create( Canvas.class);

        Canvas decodedObject = null;

 try {

  decodedObject = (Canvas)ssf.createStreamReader( buffer ).readObject();

 } catch (SerializationException e) { e.printStackTrace();}

        return decodedObject;

    }

    private class SerializePolicy  extends SerializationPolicy {

      @Override

        public boolean shouldDeserializeFields(Class<?> clazz) {

                return false;

        }

        @Override

        public boolean shouldSerializeFields(Class<?> clazz) {

                return false;

        }

        @Override

        public void validateDeserialize(Class<?> clazz)

                        throws SerializationException {

        }

        @Override

        public void validateSerialize(Class<?> clazz) 
throwsSerializationException {

        }

    }

}


I have this file inside the server package, but i am calling it client 
side, is that the  issue? any help would be greatly appreciated.


Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/kQ51M3gcykoJ.
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