Thanks guys. Yau: that's an interesting technique, but not quite what
I need (which is to marshal/unmarshal on the client side for local
storage). Olivier, I can't quite make out how your stuff would work,
but I see it's basically annotation based and generates the marshal/
unmarshal code - which is what I actually ended up doing myself.

For those interested, I've implemented an annotation of my own
(@JsonSerializable). All you need to do is add this to the classes (or
enum types) that need serialization, and the processor looks at the
public fields and generates the marshal/unmarshal code. Works for the
basic Java types as well things like enum and ArrayList and handles
nested classes (which I use a lot). Pretty neat and extremely handy,
if you're considering local storage.

Except, implementing annotations is a pain if it's the first time (it
was for me and took me a couple of days to implement/test), so once my
project eases up, I'll try to upload the library for others who might
want to use local storage this way.

I can tell you the results are excellent. If you want to see this in
operation and decide if it's worth the effort, check out my app at
http://herdcall.com - it's beta right now, but it's open at this time.
You don't need to set up an account, log in with your Facebook or
Gmail login (LinkedIn, Twitter, and Yahoo! not operational yet).
Everything is cached in local storage, including your friend ("herd")
list, for which you'll see dramatic improvement in load time.

On Jul 16, 2:18 am, Olivier Monaco <olivier.mon...@free.fr> wrote:
> Hi Sekhar,
>
> You have some framework like piriti (http://code.google.com/p/piriti/)
> for JSON serialization of data. It can be a good start. However, it
> does not use overlays: it copy JSON values to POJO fields.
>
> Maybe you can be interested in my 
> code:http://code.google.com/p/tyco/source/browse/?repo=tikray
> The idea is to define interfaces for data. A generator automatically
> create implementation for GWT with zero-overhead (no field copy, just
> wrappers arround JSON value that will be removed by the GWT
> optimizer). This part starts to work with (many) limitations. The
> second part is to create some Java proxy to use the same mechanisms on
> server. I'm owrking on. Maybe this code can help you.
>
> Olivier
>
> On 15 juil, 18:03, Sekhar <sek...@allurefx.com> wrote:
>
>
>
> > Thanks guys, yes looks like JSON is the way to go. POJO->JSON should
> > be easy (using the JSON API), but the other way is a bit tricky. I
> > don't think overlays help because the JavaScript side never sees the
> > objects (just the string) and the JSON->POJO process shouldn't depend
> > on the specific class. As I understand overlays (http://goo.gl/fNzG),
> > you need to (1) have the object in JS and (2) know the attributes.
>
> > I'm experimenting with rolling my own, will post back results.
>
> > On Jul 15, 8:08 am, Paul Stockley <pstockl...@gmail.com> wrote:
>
> > > You could use JSON and javascript overlay types to access the
> > > information in a type safe way.
>
> > > On Jul 15, 10:55 am, Stefan Bachert <stefanbach...@yahoo.de> wrote:
>
> > > > Hi Sekhar,
>
> > > > this is my first thought. Just use JSON. Then you can use "eval" to
> > > > read it.
> > > > However, I do not know any method to export a object to json string.
> > > > But this should not be too complicated to do yourself, or lookout for
> > > > such a library
>
> > > > Stefan Bacherthttp://gwtworld.de
>
> > > > On 15 Jul., 01:34, Sekhar <sek...@allurefx.com> wrote:
>
> > > > > Thanks, yeah - sawhttp://goo.gl/fTloafterIposted. So, I guess
> > > > > we'll need to implement something of our own, like a simple to/from
> > > > > JSON strings. Any other thoughts/suggestions?
>
> > > > > On Jul 14, 3:37 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
>
> > > > > > On 14 juil, 21:41, Sekhar <sek...@allurefx.com> wrote:
>
> > > > > > > Guys, I'm trying to use HTML5 Local Storage and am wondering how 
> > > > > > > I can
> > > > > > > save the data from the server as a string. Since GWT-RPC already
> > > > > > > serializes/deserializes Java serializable objects, is there a way 
> > > > > > > to
> > > > > > > access its serialization functions to marshal the data to/from the
> > > > > > > Local Storage strings?
>
> > > > > > You can gain access to the GWT-RPC serialization code (provided your
> > > > > > objects are used in a GWT-RPC somewhere, so the GWT compiler 
> > > > > > generates
> > > > > > the appropriate serialization/deserialization code), but it won't be
> > > > > > of any help in your case, as GWT-RPC serialization is asymmetric 
> > > > > > (for
> > > > > > performance reasons).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@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