GWT 页面上的 GWT 与 Spring Security 缓存问题

发布于 2024-12-04 09:18:57 字数 632 浏览 0 评论 0原文

我觉得这很奇怪,我无法找到有类似问题的人的任何信息。无论如何,我已经将 Spring Security 与 GWT 集成,并且它似乎在大多数情况下都能正常工作。我在 IE 和 Chrome 中遇到了 html 主页面的缓存问题。

我已将 Spring Security 登录分离到一个 login.jsp 中,该登录会重定向到我的 Application.html 页面(GWT 页面),当我第一次启动应用程序并访问该页面时,它似乎在所有浏览器中都能正常工作。我被定向到登录页面,因为我没有经过身份验证。

问题是,在 Chrome 或 IE 中,如果我在成功登录后关闭浏览器,并直接浏览回该 Application.html URL,它仍然呈现为好像我已通过身份验证一样。我查看控制台,Spring Security 的日志语句验证我没有经过身份验证。当我按 f5 刷新页面时,我被引导回 login.jsp url。

我相信这是一些缓存问题,因为当我关闭浏览器并重新打开 html 页面时,即使它呈现得像我已登录,控制台日志语句却说我没有登录,并且如果我运行调试模式下,Application.java 中的 OnModuleLoad() 永远不会被命中。

最后,这似乎在 Firefox 中可以正常工作...如果有人看到这个问题或对我需要修复的地方有任何建议,我将非常感谢您的帮助。

I find this kind of odd I haven't been able to find any information on someone with a similar issue. Anyway, I've integrated Spring Security with GWT, and it appears to work correctly...for the most part. I'm having a caching issue with the main html page in IE and Chrome.

I've separated out Spring Security login to a login.jsp that redirects to my Application.html page (the GWT page), and when I first start the app and access the page, it appears to be working fine in all browsers. I get directed to the login page, because I'm not authenticated.

The issue is that in Chrome or IE, if i close the browser after a successful login, and directly browse back to that Application.html URL, it still renders as if I'm authenticated. I look in my console, and the log statements for spring security verify I am not authenticated. The moment i hit f5 to refresh the page, I get directed back to the login.jsp url.

I'm lead to believe this is some caching issue because when I close the browser and reopen to the html page, even though it renders like I'm logged in, the console log statements say I'm not, and if I run in debug mode, the OnModuleLoad() in Application.java never gets hit.

Finally, this appears to work properly in firefox...If anyone has seen this issue or has any advice of where I need to look to fix, I would greatly appreciate the assistance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赢得她心 2024-12-11 09:18:57

我在开发的网络应用程序中遇到了类似的问题。我尝试通过将这些标签添加到页面来阻止浏览器缓存页面:

<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

不幸的是,这不足以阻止所有浏览器的缓存。我最终将页面转换为 JSP 页面,并将这些语句添加到顶部:

<%
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
%>

自从我进行更改以来,我无法在 Firefox、Chrome 或 Safari 中重现该问题。我还没有使用 Internet Explorer 测试该页面。

I've encountered a similar problems with a web app that I've been working on. I attempted to prevent the browser from caching the page by adding these tags to the page:

<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

Unfortunately, this wasn't enough to prevent caching for all browsers. I finally ended up converting the page to a JSP page and adding these statements to the top:

<%
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
%>

I haven't been able to reproduce the problem in Firefox, Chrome or Safari since I made the change. I haven't tested the page with Internet Explorer yet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文