cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
455
Views
1
Helpful
4
Replies

Issues with 7970 XML caching

john.chillemi
Level 1
Level 1

I've been developing a series of services for use on the 7940 and 7970 phones, but when began compatibility testing for the 7970's, i noticed that it caches the content of previous xml pages visited.

Some parts of the services i've created rely on pages always being re-freshed when they are returned to by pressing the exit soft key. Is there any way to enforce a page-refresh on the 7970's?

I'd thought there might be a recognized header-tag to enable this, though using page expiries is clearly out of the question.

Any help would be greatly appreciated.

4 Replies 4

msabir
Level 4
Level 4

On the page, that is supposed to expire, add a date header like in this Java code:

response.setDateHeader("Expires",-1);

Cheers, and don't forget to rate this post :)

I understand how to use page expiries to remove elements from the URL stack, but i'm looking to have an item which will be returned to, but will refresh itself upon return. (This happens on the 7940's automatically, because they have no page caching ability, but the 7970's have a cache, and won't automatically re-load previous pages.)

An example of the header to do this in HTML terms would normally be Pragma = "no-cache" or Cache Control = "no-cache". I'm wondering if they'res a phone-recognised equivalent header. or some other solution. (Neither of the above headers seem to be recognised by the phone.)

Unfortunately, "response.setDateHeader("Expires",-1); " isn't going to cut it in Java.. it's code that works on IIS. The above would return in an expiration header that is 1 minute before "right now", whereas in Java, the return value is "-1", and you'd like "right now minus 1 minute" instead. I have not found any other way but to construct the time string manually, e.g. like this:

public static String getServerTimeString()

{

Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));

cal.add(Calendar.MINUTE, -1);

SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss", new Locale("en", "US"));

String datetime = sdf.format(cal.getTime());

datetime += " GMT";

return datetime;

}

Since this code is timezone dependant, you might just want to subtract more than a minute (e.g. in my case I'm in timezone GMT+1 so with the summer time, if I subtract 2 hours I'm always on the safe side)

I use the trick of appending the URL with a dummy random number to "trick" the phone into thinking that it is a new page, i.e:

http://www.phonetop.com/coolApps.jsp?dummyNumber=12