Example usage for com.google.gwt.user.client.rpc.impl ClientSerializationStreamWriter toString

List of usage examples for com.google.gwt.user.client.rpc.impl ClientSerializationStreamWriter toString

Introduction

In this page you can find the example usage for com.google.gwt.user.client.rpc.impl ClientSerializationStreamWriter toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:de.csenk.gwt.ws.client.filter.serialization.ClientGWTSerializer.java

License:Open Source License

@Override
public String serialize(Object obj) throws SerializationException {
    ClientSerializationStreamWriter streamWriter = new ClientSerializationStreamWriter(serializer,
            moduleBaseURL, serializationPolicyName);
    streamWriter.prepareToWrite();//from   www.j  a v a2  s . c om

    String typeString = typeStringMap.get(obj.getClass().getName());
    if (typeString == null || typeString.length() <= 0)
        throw new SerializationException(
                "Serializer tried to serialize an unmapped class '" + obj.getClass().getName() + "'");

    streamWriter.writeString(typeString);

    if (obj instanceof String) {
        streamWriter.writeString((String) obj);
    } else {
        streamWriter.writeObject(obj);
    }

    return streamWriter.toString();
}

From source file:org.atmosphere.extensions.gwtwrapper.client.GwtClientSerializer.java

License:Apache License

public String serialize(Object message) throws SerializationException {
    try {/*from  w  w w. ja  va  2  s.c om*/
        Serializer serializer = getRPCSerializer();
        ClientSerializationStreamWriter writer = new ClientSerializationStreamWriter(serializer,
                GWT.getModuleBaseURL(), GWT.getPermutationStrongName());
        writer.prepareToWrite();
        writer.writeObject(message);
        return writer.toString();
    } catch (RuntimeException e) {
        throw new SerializationException(e);
    }
}

From source file:org.atmosphere.gwt.client.AtmosphereGWTSerializer.java

License:Apache License

@SuppressWarnings("unchecked")
public <T extends Serializable> String serialize(T message) throws SerializationException {
    if (getPushMode() == SerialMode.RPC) {
        try {/*from  w w  w.  j a v  a2 s. c om*/
            Serializer serializer = getSerializer();
            ClientSerializationStreamWriter writer = new ClientSerializationStreamWriter(serializer,
                    GWT.getModuleBaseURL(), GWT.getPermutationStrongName());
            writer.prepareToWrite();
            writer.writeObject(message);
            return writer.toString();
        } catch (RuntimeException e) {
            throw new SerializationException(e);
        }
    } else if (getPushMode() == SerialMode.PLAIN) {
        return message.toString();
    } else {
        throw new UnsupportedOperationException("Not implemented yet");
    }
}

From source file:org.atmosphere.gwt20.client.GwtRpcClientSerializer.java

License:Apache License

@Override
public String serialize(Object message) throws SerializationException {
    try {/*from w  ww.j a v a  2 s.co m*/
        Serializer serializer = getRPCSerializer();
        ClientSerializationStreamWriter writer = new ClientSerializationStreamWriter(serializer,
                GWT.getModuleBaseURL(), GWT.getPermutationStrongName());
        writer.prepareToWrite();
        writer.writeObject(message);
        return writer.toString();
    } catch (RuntimeException e) {
        throw new SerializationException(e);
    }
}