I’m writing a Flex app using REST requests and trying to avoid HTTP caching as well as synchronize client/server time. To this end I’ve created a timestamp property as such:
// returns a timestamp corrected for server time
private function get timestamp() : Number
{
return new Date().getTime() + clientClockAdjustMsec;
}
(The clientClockAdjustMsec I’ve already set using special mojo)
I also attempt to include the timestamp in my query string like this:
<mx:HTTPService url="/Service?ts={timestamp}" ...
But what I see in the access logs is weird. It’s something like this:
1.2.3.4 - - [06/Aug/2009:17:19:47 +0000] "GET /Service?ts=1249579062937 HTTP/1.1" 200 478
1.2.3.4 - - [06/Aug/2009:17:20:13 +0000] "GET /Service?ts=1249579062937 HTTP/1.1" 200 500
1.2.3.4 - - [06/Aug/2009:17:20:14 +0000] "GET /Service?ts=1249579062937 HTTP/1.1" 200 435
See how the timestamps are all the same? So strange. I would expect it to evaluate the property every time, as it does for Bindable variables.
(Actually, I just checked again and it does do the same thing for Bindable variables. But not with all clients. Do some versions of Flash have “issues”?)
so this is a read only getter? Binding isn’t going to update {timestamp} in your HTTPService component as it has no property to bind to. timestamp is the output of a function (as Christopher mentions below) and is not a Bindable property. You need to either create a bindable property, or explicitly set the URL with a current timestamp, avoiding binding altogether.
Someplace in your code you are using myService.send(), you need to do something like:
if for some reason that didn’t work:
thus avoiding any binding issues…