The UP.Link platform supports a multipart MIME format, called a digest, which allows you to send one or more entities--that is, HDML decks and the other content types listed in Valid content types--in a single message to the UP.Link server. This enables you to optimize use of the wireless network and make your service's user interface appear more responsive to the user.
If you know that the user will request multiple entities, you can send them all in a single response, instead of sending them individually as the user requests them. Because each HTTP request-response cycle involves a minimum time overhead regardless of the amount of data transmitted, sending a single response is normally much more efficient than sending multiple responses.
The digest follows the standard multipart MIME format. The following is a high-level view of the format:
Digest header Boundary Content entity Boundary Content entity Boundary
Each content entity must include the required Content-type header. For a content entity to be referenced by another entity, it must also include a Content-location header. The Content-location header must specify a URL relative to the digest URL.
For example, Figure 3-1 illustrates a simple digest containing two HDML decks. Note that when the user navigates from deck1 to deck2, the UP.Phone does not need to issue another request to the UP.Link server. It simply retrieves it from the digest, which is already in memory. This improves the performance when the user navigates between the decks.
FIGURE 3-1. A digest containing two decks
The UP.SDK provides Perl and C libraries that make it easy to generate digests. The following sections describe how to use these libraries.
To generate a digest with the UP.SDK Perl libraries, you follow these general steps:
Digest.pm and HDMLutils.pl libraries in your code. The libraries are provided in sdk_installdir/examples/apputils.
new() method to create a digest.
For example, to add a deck, use the addHDMLDeck() method; to add a cache operation, use addCacheOp().
OutputDigest() function to output the digest to standard output.
For example, the following Perl code generates the digest shown in Figure 3-1:
To generate a digest with the UP.SDK C digest library, you follow these general steps:
digest.h header file in your code. The header file and the associated object files are provided in sdk_installdir/examples/source/digests.
DigestConstruct() method to create a digest.
For example, to add a deck, use the DigestAddDeck() function.
DigestSerialize() function to formulate the digest as a multipart MIME response and store it to a buffer.
DigestDestruct() to destroy the digest.
When you compile and link your code, you must compile the digest.c file. The sdk_installdir/examples/source/digests directory includes a sample file (test1.c) and makefiles for Solaris SPARCworks/ProWorks (Makefile) and Visual C++ (test1.mak) that demonstrate how to use the library.
The following C code generates the digest shown in Figure 3-1:
examples/source/digests */