HTML5 Storage: Is it possible to expose/use the serializer/de-serializer used by GWT-RPC internally on the client??

67 views
Skip to first unread message

-sowdri-

unread,
Aug 29, 2011, 1:11:41 AM8/29/11
to google-we...@googlegroups.com
Hi,

For utilizing HTML5 storage, we have to serialize/de-serialize object(s) on the client. But the output need not be necessarily human readable, so is it possible to utilize GWT-RPC serializer/de-serializer for this purpose, such that we could serialize RPC-serializable types, (including Google Collections) painlessly??

Any thoughts on this??

Thanks,

Alex Dobjanschi

unread,
Aug 29, 2011, 3:09:37 AM8/29/11
to google-we...@googlegroups.com
I can understand your point of view (having some generalized/simplified way to use storage + RPC), but I would not do that. Internal data-structure could change between versions, and you need a way to "inject" the data at the bottom-level of RPC mechanism (right when the bytes get off wire).

My 2 cents,
Alex.

Thomas Broyer

unread,
Aug 29, 2011, 5:11:04 AM8/29/11
to google-we...@googlegroups.com
GWT-RPC is not a symmetric protocol, so you can't use the existing serializer/deserializer code, you'd have to port the server-side ones to client-side and choose one of the two serialization format.

J.Ganesan

unread,
Aug 29, 2011, 6:45:13 AM8/29/11
to Google Web Toolkit
Reflect the classes in the server. Request for the reflection
information from the client. The reflection information should have
version information too. With the reflection information, custom-
serialize the objects in the client and save/read locally. The custom-
serialization will be hard if your objects have data structures like
HashMap or have circular references.
Hope it helps.

J.Ganesan
www.DataStoreGwt.com

-sowdri-

unread,
Aug 29, 2011, 9:01:48 AM8/29/11
to google-we...@googlegroups.com
@Thomas

>> GWT-RPC is not a symmetric protocol, ...

Guess, we cant straight away use the existing serializer/de-serializer! 

Any plans for official support for serializer/de-serializer for the purpose of HTML5 storage??

Thanks,


Thomas Broyer

unread,
Aug 29, 2011, 9:19:51 AM8/29/11
to google-we...@googlegroups.com
RequestFactory and AutoBeans are the way to go. GWT-RPC will continue to be maintained, and its performance and security be worked on, but I don't think they'll enhance it anymore.
"DeRPC" was supposed to be a "better RPC" but has finally been dropped (in favor of RequestFactory).

joergviola

unread,
Aug 29, 2011, 12:03:03 PM8/29/11
to google-we...@googlegroups.com
I used JSON for that purpose.
But you have to write the serializers by yourself.

Or you could take a look at https://code.google.com/p/mobile-objects/, which is brand-new and currently in alpha, but capable of storing GWT Objects transparently to HTML5 database or storage, whatever available.

-sowdri-

unread,
Aug 30, 2011, 1:05:35 AM8/30/11
to google-we...@googlegroups.com
I completely agree with the fact that RequestFactory is the way to go!  I use RF in all my projects. But I also use RPC along side, esp. when it comes to Google Collections (Table DS for instance). 

Or to put the question other way around: 

Is it possible to make ValueProxies, which can embed Guava - GWT Serializable types?? 

## 

And regarding serializing the EntityProxies, I use AutoBeans directly. I tried using RF ProxySerializer with no luck. 

To create a self-contained message that encapsulates a proxy:

// taken from the javadocs

 RequestFactory myFactory = ...;
 MyFooProxy someProxy = ...;
 
 DefaultProxyStore store = new DefaultProxyStore();
 ProxySerializer ser = myFactory.getSerializer(store);
 // More than one proxy could be serialized
 String key = ser.serialize(someProxy);
 // Create the flattened representation
 String payload = store.encode();
 
To recreate the object:
 ProxyStore store = new DefaultProxyStore(payload);
 ProxySerializer ser = myFactory.getSerializer(store);
 MyFooProxy someProxy = ser.deserialize(MyFooProxy.class, key);

In that case, should we store the key seperately. Or am I missing something??


Regards,  

Reply all
Reply to author
Forward
0 new messages