Java的小程序1.7 CacheEntry preventing动态更新 [英] Java 1.7 applet CacheEntry preventing dynamic updates

查看:220
本文介绍了Java的小程序1.7 CacheEntry preventing动态更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我迁移的Java小程序1.6到Java 1.7。我们的一个小程序定期击中URL检索一个动态的状态值:

I am migrating Java 1.6 applets to Java 1.7. One of our applets periodically hits an URL to retrieve a dynamic status value:

https://host/myapp/path/to/status

然后它根据最新的状态值更新。由于升级到Java 1.7,我的客户不检索最新的状态值。我看到这样的条目在Java控制台:

And then it updates according to the latest status value. Since upgrading to Java 1.7, my client does not retrieve the latest status value. I see entries like this in the Java console:

CacheEntry[https://host/myapp/path/to/status]: updateAvailable=true,lastModified=Wed Dec 31 17:00:00 MST 1969,length=82

它看起来像客户端有该网址一些缓存值,实际上不是从服务器检索最新的动态值。

It looks like the client has some cached value for that URL and isn't actually retrieving the latest dynamic value from the server.

这工作得很好为1.6小程序,它也能正常工作作为一个独立的1.7的Java应用程序。我怎么能作为一个小应用程序1.7运行时,禁用或绕过这个缓存行为?

This worked fine as a 1.6 applet, and it also works fine as a 1.7 standalone Java application. How can I disable or bypass this caching behavior when running as a 1.7 applet?

推荐答案

我已经解决了通过在服务器响应使用下面的HTTP标头这样的问题:

I've resolved this problem by using the following HTTP header in the server response:

Cache-Control: no-cache, no-store, no-transform

现在我的Java小程序1.7从获取服务器的数据每次。显然,甲骨文改为小程序在Java 1.7这些头如何回应。 previously(当我们使用Java小程序1.6),我们有以下标题:

Now my Java 1.7 applet fetches the data from the server every time. Apparently Oracle changed how applets respond to these headers in Java 1.7. Previously (when we were using Java 1.6 applets), we had the following header:

Cache-Control: no-cache

和用Java 1.6的工作,但不是在1.7。

and that worked in Java 1.6 but not in 1.7.

这篇关于Java的小程序1.7 CacheEntry preventing动态更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆