You also need to define a MIME type for the manifest in the web.xml deployment descriptor as follows:
<mime-mapping> <extension>manifest</extension> <mime-type>text/cache-manifest</mime-type>
</mime-mapping>
22.7.2. Enabling Offline Mode
To enable the offline mode, you need to add the OfflineModeSettings extension to the UI.
OfflineModeSettings offline = new OfflineModeSettings();
...
offline.extend(this);
You can extend the OfflineModeSettings extension to to transfer data conveniently from the offline UI to the server-side, as described in Section 22.7.4, “Sending Data to Server”.
22.7.3. The Offline User Interface
An offline mode is built like any other client-side module, as described in Chapter 13, Client-Side Vaadin Development. You can use any GWT, Vaadin, add-on, and also TouchKit widgets in the offline user interface.
Most typically, a client-side application builds a simplified UI for data browsing and entry. It stores the data in the HTML5 local storage. It watches if the server connection is restored, and if it is, it sends any collected data to the server and suggests to return to the online mode.
Please see the Vornitologist source code for an example implementation of an offline mode user i n t e r f a c e . T h e com.vornitologist.widgetset.client.VornitologistOfflineMode.java is the main module of the offline application.
22.7.4. Sending Data to Server
Once the connection is available, the offline UI can send any collected data to the server-side. You can send the data from the offline UI, for example, by making a server RPC call to a serverside UI extension, as described in Section 16.6, “RPC Calls Between Clientand Server-Side”.
22.7.5. The Offline Theme
Normally, client-side modules have their own stylesheets in the public folder that is compiled into the client-side target, as described in Section 16.8, “Styling a Widget” and Section 13.3.1, “Specifying a Stylesheet”. However, you may want to have the offline mode have the same visual style as the online mode. To use the same theme as the server-side application, you need to define the theme path in the widget set definition file as follows.
<set-configuration-property name='touchkit.manifestlinker.additionalCacheRoot'
value='src/main/webapp/VAADIN/themes/mytheme:../../../VAADIN/themes/mytheme />
You need to follow a CSS style structure required by the Vaadin theme in your offline application. If you use any Vaadin widgets, as described in Section 15.3, “Vaadin Widgets”, they will use the Vaadin theme.