GWT Object Serialization with gwt-storage


The built in Java Serialization and various serialization frameworks available for Java allow to serialize Java objects conveniently into binary or textual representations. Unfortunately, most of these frameworks are not available for Google Web Toolkit client applications.

There is no easily available built in solution for serializing GWT objects into text on the GWT client side. This is surprising since GWT evidently has a mechanism to serialize and deserialize objects to support GWT RPC.


Seanchenxi has kindly created a convenient wrapper around the GWT RPC serialization mechanism, which makes it very easy to serialize and deserialize objects on a GWT client application into String representations. The project, gwt-storage, is available on github:

You can download the source code and import it to your Java project. I’ve also uploaded the project to a public Maven repository. You can add it to your Maven project as follows:















With gwt-storage available for your project, you can do the following in GWT client side code:

StorageSerializer serializerImpl = new;

try {

MyClass obj = new MyClass("1234");

String serialized = serializerImpl.serialize(Serializable.class, obj);

GWT.log("Serialized Object: "+serialized);

MyClass deserialized = (MyClass) serializerImpl.deserialize(

Serializable.class, serialized);

} catch (SerializationException e) {

throw new RuntimeException(e);



  • If you download the gwt-storage source code, you might have to change the visibility of the class StorageRPCSerializerImpl() to public (from package).
  • MyClass needs to be serializable by GWT RPC; that is, implement Serializable and have non-transient references that are Serializable as well.
  • If you change the implementation of the class MyClass, deserialization of Strings created with older versions of the class will probably not be possible.


Serializing objects in GWT and deserializing them in servlet

GWT Google Groups ‘GWT client side Java object serialization’

Puppet Slow With Processing Directory with ‘recurse => true’

The Problem

Puppet allows deploying a structure of directories and files conveniently using the file resource.

Using the attributes ‘source => …’ and ‘recurse => true’, it is possible to create a copy of a set of files stored in the puppet module on target servers.

Unfortunately, using these attributes can slow down puppet significantly when the target directory on the server contains many files.

In my case, the time it took to apply a catalog jumped from under 5 seconds to more than 300 s.

The Solution

If you are lucky, the related puppet bug #9671 is closed in your version of puppet (not as of time of this writing).

If not, I found the following strategy to be effective:

  • Replicate your base directory structure using plain file resources (without recurse => true).
  • For subdirectories, do either:
    • Create a resource using ‘recurse => true’, for directories which contain many files/subdirectories in your puppet project.
    • Create more plain file resources for directories, which contain many files on the server.

Using this strategy, I was able to reduce the time to apply mentioned catalog below 10 s, while maintaining most of the convenience offered by the ‘recurse’ attribute.