How can I make my J2EE web application work offline?

Gears is deprecated because the HTML5 standard allows for equivalent features to be present in compliant browsers.

Gears is deprecated because the HTML5 standard allows for equivalent features to be present in compliant browsers. With respect to your current problem at hand of handling offline web application access, you can look into the support offered by HTML5 for offline web applications via support for client-side SQL database access, and the client-side application HTTP cache. The features will have to be used in conjunction, as the client-side database access will allow for storage of data (generated when the application is offline) in a structured format, while the offline application cache will allow for caching of HTTP responses from the server; you should not be caching responses that are dynamic in nature which depend on any user-provided inputs.

The details of the proposed APIs can be found in the W3C HTML5 specification, which is in draft at the moment, although it appears that certain user-agents have already implemented this feature.

Firstly, you will need some form of offline storage. HTML5's capabilities are the successor to Google Gears, as stated on the google gears developer blog; essentially, the purpose of Google Gears was just to push the development & subsequent adoption of HTML 5 features. Specifically you should be looking at the HTML5 offline (here's a tutorial) APIs, and the Storage APIs may also come in handy (relevant tutorial).

With regards to design, you will essentially need to maintain your complete web application state client side, and then send over the differences (i.e. Update the server-side state) as soon as the connection to the server is available again. Off the top of my head, there's 2 simple ways to design this: Explicitly maintain separate application states for the client and server.

Essentially, when the user takes an action, it's applied to the client application state first, and then at specified intervals (and/or triggers, e.g. The user clicks the save button), the client sends over the differences between the last known state of the server and the current state of the client. This is probably best suited to highly interactive web applications, and I suspect Google Docs works on this kind of design. Depending on your application (if "conflicting changes" can occur), you'll need to also account for merging application state: do you override with the last received client state, or do you intelligently try to merge?

(you'll have to decide which makes more sense for your particular application. ) Record user actions while offline, and replay them once the connection becomes available again. You essentially implement the Command design pattern, and have both your client-side code and server-side code able to handle each command.

The client-side code always handles each command, and while the connection to the server is available, your client side code also sends off the commands to the server. You'll probably want to implement some batching, to avoid continual requests to the server, and also some roll-back functionality when requests to the server fail (e.g. Conflicting changes). This ends up looking more or less like GMail's main email managment user interface, where you can undo operations.

This has not much to do with J2EE, but rather how you code your web-client. One possible solution would be to use a javascript client that does save the data in the local storage introduced with html5 (see diveintohtml5.ep.io/storage.html ). That is also basically the reason why google gears was stopped ...

I have seen those friend but if the cache of the browser is cleared then it would not work. This is one of the loopback in this. – deepmoteria Aug 24 at 7:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions