Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

How to Implement a Web Cache for Your BrowserField2 Application

by Retired on ‎03-08-2011 01:35 PM - edited on ‎03-08-2011 01:46 PM by Retired (7,098 Views)

 

 

So, loading pages on your BrowserField2 application is taking quite some time and yet your app is repeatedly loading the same pages over and over again spending network bandwidth and providing a poor performance experience to users?


You've been thinking of implementing a web cache but has no idea how to extend the BrowserField2 (a.k.a. BF2) API for that purpose?


This article is definitely for you!


 


 

Goal

 

This article discusses how the BrowserField2 API (BlackBerry® Device Software 5.0 and later) can be properly extended to implement a simple web cache mechanism that will speed up the loading of pages and resources in a BF2 application significantly reducing bandwidth usage, server load, and ultimately improving the user experience. The code provided (please check the attachments) should serve as a basis for developers to build their own professional caching mechanism tailored to their particular needs.

 

The term "web cache" (from now on simply referred to as "cache") will be used throughout this article to refer to a cache of HTTP resources (e.g., a web page, an image, a css file) in which HTTP headers and page content (sequence of bytes) are store together in a cache entry and later used to quickly reload HTTP resources. In terms of data persistency the source code provided implements a "short-term cache", i.e.,  a cache that will not persist data after a device boot. For fur