GWT - spring security - 缓存问题
我有一个由 Spring Security 保护的 GWT 应用程序。我有一个为应用程序提供服务的 Main.html 和用于登录的 Login.html。在大多数情况下,每次都一切正常。但有时重新启动我的应用程序后,我仍然可以访问 Main.html - 尽管页面上的大多数小部件都无法使用。我可以看到控制台中的 Login.html 的 HTML 作为异常被打印。刷新后,我会进入登录页面。有人遇到过类似的问题吗?这是某种缓存问题吗?如何避免这种情况?
I have a GWT application which is secured by Spring Security. I have a Main.html which serves the application and Login.html for login. For most part everything works fine everytime. But sometimes after restarting my application I can still access Main.html - although most of the widgets on the page are unusable. I can see the Login.html's HTML in the console being printed as exception. On refreshing, it takes me to login page. Has anyone ran into similar issue? Is this some kind of caching issue? How can this be avoided?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的情况下,您的引导文件似乎正在被缓存,因此正在加载应用程序的错误版本。
您必须确保您的引导文件(名为
nocache
的文件)永远不会被缓存。请参阅此处了解更多详细信息。您可以使用 Firebug 并查看脚本的 HTTP 请求来检查引导文件是否已缓存。您可以检查两件事:
.cache.html
(将其与 gwt 输出文件夹中的内容进行比较)。.nocache.
文件的响应类型不是 304 左右。It seems that in your case your bootstrap file is beining cached and thus a wrong version of your app is being loaded.
You have to make sure that your bootstrap file (the one which is named
nocache
) is never cached. See here for more details.You can check if your bootstrap file is cached by using Firebug and looking at the HTTP requests for your scripts. You can check two things:
<md5>.cache.html
are loaded (compare it to the ones in your gwt output folder)..nocache.
file is not 304 or so.在我的 Main.html 顶部添加元标记 - 帮助我暂时解决了我的问题。
阅读此内容以了解更多详细信息:HTML http-equiv 属性
Adding meta tag on top of my Main.html - helped me resolve my issue for now.
Read this for more details : HTML http-equiv Attribute