Offline Web Applications and Caching of Web Resources
Todd Kaplinger 2700000G7N Visits (6252)
With the explosion of mobile devices such as tablets and smart phones, the ability to be able to work in what is called disconnected mode becomes a requirement. In support of this requirement, HTML5 provides the ability for developers to define what is called an application cache manifest file. Inside of this application cache, developers can denote which files that are associated with the application can be cached indefinitely by the browser. By enabling this cache, the browser can now retrieve web resources from it's local cache without having to request these resources via the network to the web server that is hosting the web content.
The HTML5 specification provides an overview of how this cache can be defined. To demonstrate how this can be used, I am including the following example from this specification.
The author can instead provide a manifest of the three files:
<!-- clock.html -->
<link rel="stylesheet" href
<p>The time is: <output id="
The one aspect of this document that is beyond the scope of the specification is how to actually configure the various application and web servers to serve these application cache files. In the following section I will provide basic configuration steps that can be used for a variety of servers.
WebSphere Application Server 8.0.X (WAS 8)
In WAS 8, the admin console allows administrators to configure additional MIME types based upon file extensions. To configure application cache for the example above, the MIME type would be configured as "tex
For further details on the exact steps, please refer to the WebSphere Application Server V8.0 InfoCenter.
WebSphere Application Server Community Edition (WAS CE)
WAS CE leverages Tomcat for it's Webcontainer implementation. As part of Tomcat's configuration support, there is a global web.xml that provides configuration for various aspects of the webcontainer. One of these configuration options is for mime-mappings. To configure application cache for the example above, the mime-type would be confgured as "tex
For further details on the exact steps, please refer to the WAS CE docu
Apache has the ability to configure mime types in many different ways (see this link, for more details). In this document, I will denote what I think is simplest which is the .htaccess file. The .htaccess file is a web resource that can be included in the same directory as the application manifest. To configure the webserver to send the appropriate content type header for appcache, the following directive would be used.
AddType text/cache-manifest .appcache
For further details on .htaccess files, please refer to the Apache documentation.