GWT RPC Serialization for LocalStorage
Unfortunately, the devil lies in the details here, since GWT RPC is implemented in an asymmetrical way:
- The client can only deseralize objects serialized on the server and
- Only the server can deseralize objects serialized on the client.
Fortunately, however, with a few modifications the GWT RPC serialization mechanism can be adjusted to support client-client serialization.
The gwt-storage project available on GitHub does exactly that for us. Check out the getting started guide for this project here. Here a simple example:
StorageExt localStorage = StorageExt.getLocalStorage();
GwtClass gwtObject = localStorage.get(key);
Note that for this code to work, GwtClass must be involved in one of your GWT RPC services.
Stackoverflow 'How to apply SerializationStreamWriter for storage'