Tuesday, May 4, 2010

Domino 8.5.2 & Cache Manifest, not just for offline use

Over on Niklas Heidlhoff's blog is an example of how to use a cache-manifest file and how to make an offline app with X-Pages. This is great news for mobile developers.

But what if you don't want or need the app to be offline? What advantages do you get with a cache manifest?

Speed!

Lets say you have a mobile app(or any Xpages app), it has some rather large style sheets, script libraries, and images. This is all static content, simply cache this content locally then the application is local and only connects to the server when it gets or posts information to the Notes database.

I have added many images and features to ITANA for an upcoming release. Knowing that the cache manifest would be supported in version 8.5.2, i use allot more images and css than i had previously.

Before I added the cache manifest file, it would take about 20 seconds to open this Xpages app from my iPhone, now it takes less than 5, and part of that is the iPhone opening a new Safari instance!

And here is an example cache manifest to show how to leave network connectivity in place for everything but your resources that you keep local.

CACHE MANIFEST

#version: 0.0.15

tasks4.css
tasks4.js
trashcan.png
uinext.js
ajax-loader.gif
runbuild2.png
attach.png
spinningwheel.js
spinningwheel.css
sw-alpha.png
sw-button-cancel.png
sw-button-done.png
sw-header.png
sw-slot-border.png
tasks.js
iscroll.js
home.png
wood.png
zengarden.jpg
checkbox.png
newwindow.png
cal.png
category.png

#local dojo resources
/domjs/dojo-1.4.1/dojo/dojo.js
/domjava/xsp/theme/webstandard/xsp.css
/domjava/xsp/theme/webstandard/xspLTR.css
/domjava/xsp/theme/webstandard/xspSF.css
/xsp/.ibmxspres/domino/ckeditor/contents.css
/xsp/.ibmxspres/domino/ckeditor/skins/lotus/icons.png
/xsp/.ibmxspres/domino/ckeditor/skins/lotus/images/arrowdown.gif
/xsp/.ibmxspres/domino/ckeditor/skins/lotus/images/toolbar_start.gif
/xsp/.ibmxspres/domino/ckeditor/skins/lotus/images/toolbarSprite3.png
/xsp/.ibmxspres/domino/ckeditor/skins/lotus/images/toolbarSprite.png
/domjs/dojo-1.4.1/dijit/themes/dijit.css
/domjs/dojo-1.4.1/dijit/themes/tundra/Common.css
/domjs/dojo-1.4.1/dijit/themes/tundra/layout/ContentPane.css
/domjs/dojo-1.4.1/dijit/themes/tundra/layout/TabContainer.css
/domjs/dojo-1.4.1/dijit/themes/tundra/layout/AccordionContainer.css
/domjs/dojo-1.4.1/dijit/themes/tundra/layout/SplitContainer.css
/domjs/dojo-1.4.1/dijit/themes/tundra/layout/BorderContainer.css
/domjs/dojo-1.4.1/dijit/themes/tundra/form/Common.css
/domjs/dojo-1.4.1/dijit/themes/tundra/form/Button.css
/domjs/dojo-1.4.1/dijit/themes/tundra/form/CheckBox.css
/domjs/dojo-1.4.1/dijit/themes/tundra/form/RadioButton.css
/domjs/dojo-1.4.1/dijit/themes/tundra/form/Slider.css
/domjs/dojo-1.4.1/dijit/themes/tundra/Tree.css
/domjs/dojo-1.4.1/dijit/themes/tundra/ProgressBar.css
/domjs/dojo-1.4.1/dijit/themes/tundra/TitlePane.css
/domjs/dojo-1.4.1/dijit/themes/tundra/Calendar.css
/domjs/dojo-1.4.1/dijit/themes/tundra/TimePicker.css
/domjs/dojo-1.4.1/dijit/themes/tundra/Editor.css
/domjs/dojo-1.4.1/dijit/themes/tundra/Dialog.css
/domjs/dojo-1.4.1/dijit/themes/tundra/images/titleBar.png
/domjs/dojo-1.4.1/dijit/themes/tundra/images/spriteArrows.png
/domjava/xsp/theme/webstandard/xspFF.css
/domjava/xsp/theme/webstandard/xsp.css
/domjs/dojo-1.4.1/dijit/themes/tundra/tundra.css
/domjs/dojo-1.4.1/dijit/themes/tundra/images/accordionItemHover.gif
/domjs/dojo-1.4.1/dojo/io/iframe.js
/domjs/dojo-1.4.1/ibm/domino/widget/layout/DominoRichText.js
/domjs/dojo-1.4.1/ibm/xsp/widget/layout/RichText.js
/domjs/dojo-1.4.1/ibm/xsp/widget/layout/nls/RichText_en-us.js
/domjs/dojo-1.4.1/ibm/domino/widget/layout/nls/DominoRichText_en-us.js
/domjs/dojo-1.4.1/ibm/xsp/widget/layout/xspClientDojo.js
/domjs/dojo-1.4.1/ibm/domino/widget/layout/css/domino-default.css
/domjs/dojo-1.4.1/ibm/xsp/widget/layout/nls/xspClientDojo_en-us.js

NETWORK:
#a whitelist of paths request can be made to for more dojo and other resources not listed above
/xsp/.ibmxspres/
/domjs/dojo-1.4.1/
/domjava/xsp/


5 comments:

Erik Brooks said...

Exactly how is the manifest implemented in 8.5.2? I hadn't see that.

Erik Brooks said...

Exactly how is the manifest supported in 8.5.2? I hadn't seen that.

Mark Hughes said...

@1

on the xpage properties, under all properties you will see a place for a pageManifest

Niklas Heidloff said...

Erik, you also need to make sure this manifest file is served as a special MIME type. See in the video here.

Erik Brooks said...

@Mark - Ok, that's what I figured, thanks!

@Niklas - Got it, cool.

Post a Comment