Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 防止flex缓存外部资源_Apache Flex_Http_Iis_Caching - Fatal编程技术网

Apache flex 防止flex缓存外部资源

Apache flex 防止flex缓存外部资源,apache-flex,http,iis,caching,Apache Flex,Http,Iis,Caching,我正在编写一个flex应用程序,它每隔几秒钟轮询服务器上的一个xml文件以检查更新的数据,但我在阻止它缓存数据和对更新的数据做出响应时遇到了问题 我尝试使用IIS控制面板设置标题以使用以下内容,但没有任何运气: CacheControl: no-cache Pragma: no-cache 我还尝试在请求URL的末尾添加一个随机的HTTP GET参数,但这似乎是在发出请求之前由HttpService类剥离的。下面是实现它的代码: http.url = "test.xml?time=" + ne

我正在编写一个flex应用程序,它每隔几秒钟轮询服务器上的一个xml文件以检查更新的数据,但我在阻止它缓存数据和对更新的数据做出响应时遇到了问题

我尝试使用IIS控制面板设置标题以使用以下内容,但没有任何运气:

CacheControl: no-cache
Pragma: no-cache
我还尝试在请求URL的末尾添加一个随机的HTTP GET参数,但这似乎是在发出请求之前由HttpService类剥离的。下面是实现它的代码:

http.url = "test.xml?time=" + new Date().getMilliseconds();
下面是调试日志,让我觉得它失败了:

(mx.messaging.messages::HTTPRequestMessage)#0
  body = (Object)#1
  clientId = (null)
  contentType = "application/x-www-form-urlencoded"
  destination = "DefaultHTTP"
  headers = (Object)#2
  httpHeaders = (Object)#3
  messageId = "AAB04A17-8CB3-4175-7976-36C347B558BE"
  method = "GET"
  recordHeaders = false
  timestamp = 0
  timeToLive = 0
  url = "test.xml"

有人处理过这个问题吗?

缓存控制HTTP头是“缓存控制”。。。注意连字符!它应该会起作用。如果省略连字符,则不太可能起作用。

我使用getTime()将日期转换为数字字符串,实现了这一点。我也换了一张去邮局的票。缓存不同的文件扩展名时出现了一些问题。例如,浏览器可能不会缓存.php或.jsp等标准动态扩展,并且

private var myDate:Date = new Date();
[Bindable]
private var fileURLString:String = "http://www.mysite.com/data.txt?" + myDate.getTime();
希望这对某人有所帮助

我还向它抛出了大量的标题参数,但它们从未完全做到这一点。示例:

// HTTPService called service
service.headers["Pragma"] = "no-cache";  // no caching of the file
service.headers["Cache-Control"] = "no-cache";