Wednesday, September 8, 2010

Re: GWT RPC offline caching

Hello Alex,

Sure you can do that. Have a look at [1], there's a post about how to
do the very same thing with using the HTTP GET cache - so this will
work also with non-html5 speaking browsers. Still that solution faces
the same problem of how to serialize and deserialize the data.


[1]
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/409601cf8d1d3ae1/dca716e3f7d47f5f?lnk=gst&q=rpc+get#dca716e3f7d47f5f

On Sep 8, 2:00 pm, "Alex G." <alexej.gu...@googlemail.com> wrote:
> Hello,
>
> i m working on generalized AsyncCallback class which allows to get a
> serialized string from a succesful GWT RPC response, so i can save it
> to htlm5 localStorage and use it as cached result in case RPC request
> fails.
>
> public abstract class OfflineAsyncCallback<T> implements
> AsyncCallback<T> {
>
>     private T offlineResult;
>
>     public void onFailure(Throwable caught) {
>
>          //load from localStorage
>          offlineResult = deserialize(serializedString);
>     }
>
>     public void onSuccess(T result) {
>
>         String serializedString = serialize(result);
>         //save to localStorage
>     }
>
>     private String serialize(T object) {TODO};
>     private T deserialize(String s) {TODO};
>
> }
>
> Is it possible to implement this two functions serialize() and
> deserialize() by using GWT internal class? Are there any other
> alternatives to cache GWT response?
>
> Thanks for help,
> Alex

--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate