Background client cache

Printer-friendly versionSend to friendPDF version
Intermediate

This sample code has been developed by Streamezzo.
Its purpose is to illustrate how to download scenes in background on client when connection becomes available.
Current scene comes with a queue of other scenes URL that are downloaded and stored in client cache and can be accessed instantaneously.

Queue scene (queues 10 occurences of "Item" scene)

"/> <% final int itemsNumber = 10; %> <% StzUrl url; String cachedText = ""; for (int i=0 ; i < itemsNumber; i++) { url = stzRequest.getURLMaker().createUrlForRspFile("item.rsp"); url.addParameter("index", String.valueOf(i)); cachedText += "[" + i + "]"; %> " url="<%= url %>" yes="<%= "local:reiterateTest"+i %>" no="<%= "global:cache"+i %>"/> " startTime="NEVER"> "> " url="<%= url %>" yes="<%= "global:reiterateTest"+i %>" no="<%= "global:cache"+i %>"/> " startTime="NEVER"> " field="Conditional.startTime" timevalue="NOW"/> " startTime="NEVER"> <% } %>

Item scene (occurences queued by "Queue" scene)

" append="true"/> <% int index = Integer.parseInt(stzRequest.getRequestParameter("index")); String imageURL = "http://chart.apis.google.com/chart?cht=p3&chs=250x100&chd=t:" + ((index + 1) * 10) + "," + ((10 - (index + 1)) * 10); stzRequest.getLogger().debug("Image URL" + index + "=" + imageURL); %> " horizAlign="CENTERED" vertAlign="MIDDLE"/>
AttachmentSize
Background_client_cache.swz3.95 KB
Share this