Throwing out ideas: - you can tell network errors from server errors at the RequestTransport level: server errors go through response received, while network errors go through onError. If you can work offline thogh, I'm not sure you should differentiate them: Receiver#onFailure should be enough to turn to using the localStorage. - you could use offline events (use RootPanel.get().addBitlessDomHandler to subscribe) and/or navigator.onLine() (use JSNI) to detect when you're offline (on supported browsers); see http://www.html5rocks.com/en/tutorials/offline/whats-offline/#toc-detect-offline - there are good advice for architecturing your app for offline use on the now-defunct Gears doc: http://code.google.com/apis/gears/architecture.html (not sure if they're still valid, double-check with HTML5Rocks) - You should abstract your storage and use IndexedDB (through JSNI for now) if available (and possibly WebSQL), as localStorage has performance concerns: http://hacks.mozilla.org/2012/03/there-is-no-simple-solution-for-local-storage/
On Thursday, March 8, 2012 11:21:02 AM UTC+1, Gilad Egozi wrote: > > Hello, > > I'm trying to create an application which is able to work even when > network is down. > The idea is to store data returned from RequestFactory on the > localStorage, and to use localStorage when network isn't available. > My problem - I'm not sure exactly how to differentiate between server > errors(5XX, 4XX, ...) and network errors. > (I assume that on both cases my Receiver.onFailure() would be called, but > I still don't know how to identify this situation) > > Any help would be appreciated, > > > Thanks, > Gilad. > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/3YL2btTpvcAJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
