会话值未存储在使用 Chrome 的 wicket 应用程序中
我们的 wicket 应用程序具有以下场景:
- 在会话中保存 myValue
- 将用户重定向到外部页面
- 用户输入一些数据后,外部页面重定向回我们的 web 应用程序 从
- 会话中读取 myValue 并根据 myValue 执行某些操作
一切都正常在 Firefox 中,但在 Chrome 中不行。使用 Chrome,当用户再次返回我们的 wicket 页面时,myValue 为 null。我的第一个猜测是必须创建一个新会话或者从未设置 myValue。我通过代码进行调试,会话 ID 完全相同... myValue 在用户重定向之前也已设置。
我不太明白 Chrome 和 Firefox 在将值保存到 wicket 会话时会有什么不同的行为。或者离开网页并在 1 分钟后返回网页会突然导致不同类型的会话。
Our wicket application has the following scenario:
- save myValue in the session
- redirect the user to an external page
- the external pages redirects back to our webapp after the user entered some data
- read myValue from the session and do something based on myValue
It all works just fine in Firefox, but not in Chrome. Using Chrome myValue is null when the user returns to the our wicket page again. My first guess was that a new session must have been created or that myValue was never set. I debugged through the code and the session id is exactly the same ... myValue has also been set before the user got redirected.
I don't quite get how Chrome and Firefox would behave differently when it comes to saving values into the wicket session. Or how leaving the webpage and returning to it 1 minute later would suddenly result in a different kind of session.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您提到的网站的用例 -->外部站点 -->你的网站是我在进行 OAUTH 身份验证时遇到的,其中流程是相同的,即我的网站 --> facebook --> 我的网站。
我的解决方案是不依赖浏览器会话/cookie;我保留了重新加载会话所需的所有数据,并将用户连同密钥(用于标识缓存的会话信息)一起发送到 FB,并且还让 FB 将此密钥传回我的应用程序,然后我用它来重新加载会话数据。
The use-case that you have mentioned your site --> external site --> your site is something I have encountered when I was working on OAUTH authentication where the flow is same i.e my site --> facebook -->my site.
My solution was not to rely upon browser session/cookie; I persisted all the data I needed to reload the session and sent the user to FB along with a key (used to identify the cached session information )and also had FB pass back this key to my application which I then used to reload the session data.
我完全不知所措,因为上面提到的图标解决方案对我有用。我已经为此烦恼了 3 年,不敢相信修复如此简单。我向 Chrome 报告了此修复。
我在 ContOS 5.7 中使用 Apache 2.2.14 前端 Tomcat 6.0.32。 Tomcat 托管 Java Struts 应用程序。 即可
只需添加每个 jsp 页面的所有
head
标记 。问题解决了!!I am completely floored because the favicon solution mentioned above worked for me. Been pulling hair for 3 years on this and can't believe the fix is so simple. I reported this fix to Chrome.
I'm front ending Tomcat 6.0.32 with Apache 2.2.14 in ContOS 5.7. Tomcat is hosting a Java Struts application. Simply added
in all the
head
tags for each and every jsp page. Problem solved !!