如何在 Java EE 应用程序中以编程方式避免 IE8 提供的会话共享?
为了让 Internet Explorer 8“更稳定”、“更快”,微软改变了浏览器的底层架构,并引入了名为“松耦合 IE”(LCIE) 的功能,该功能可跨 TAB 和新浏览器进行会话共享。实例。
但是,当有人尝试使用同一个应用程序同时做两件不同的事情时,会话共享可能是致命的,例如,有人想一次预订一张去程机票和一张回程机票,那时他会预订两张相同的机票门票是他无意的。
可能的解决方案
在创建新窗口而不是通过单击图标或 Ctrl+N 来创建时,我们应该使用文件 -> 。新会议;
您可以在客户端 PC 上进行注册表更改 - 添加以下内容。
<块引用>[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
“TabProcGrowth”=双字:00000000
将禁用“Loosely Couple IE8”;然后 IE8 将像以前版本的 IE 一样工作。
- 使用
iexplore.exe -nomerge
运行 MSIE 将禁用“Loosely Couple IE8”;然后 IE8 就可以工作与以前版本的 IE 一样,
但是我将如何以编程方式执行此操作?
您看,我的问题不是我的应用程序,如果我登录一个用户,但当我通过不同的用户登录多个用户时,它工作正常。 IE8浏览器,我后来的会话数据覆盖了前一个,这是因为两个IE浏览器都使用相同的会话ID,这是由于IE8的会话共享而发生的,无论我有多少用户,都只为一个应用程序维护一个会话。事实上,我想维持每个用户的会话。
就像我在一个浏览器中登录 Gmail 时一样,我不希望在我的应用程序中自动登录。我应该一次由另一个用户登录,我应该执行独立操作。
我的应用程序使用 Struts、Spring、Hibernate 和JBoss 应用服务器。
现在告诉我应该如何进行?
Microsoft, in an effort to make Internet Explorer 8 "more stable" and “faster”, have changed the underlying architecture of the browser and introduced a function called "Loosely-Coupled IE" (LCIE) which works on session sharing across TAB and new instances.
But session sharing may be fatal when some one is trying to do two different things at a time with the same application, e.g. like someone want to book one forward journey ticket and one return ticket at a time, at that time he will book 2 same tickets what he has not intended to.
PROBABLE SOLUTION ON IT
While creating a new window instead of creating by clicking on an icon or Ctrl+N, we should use File -> New Session; it will not happen.
You can make a registry change on the client PC - adding the following.
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
“TabProcGrowth" = dword : 00000000
Will disable "Loosely Couple IE8"; IE8 then works as previous versions of IE.
- Run MSIE using
iexplore.exe -nomerge
will disable "Loosely Couple IE8"; IE8 then works as previous versions of IE.
But how will I do it programatically?
You see, my problem is not my application. It's working fine if I am logging in one user, but when I am logging in multiple users through different users from different instances of IE8 browser, my later session data are overriding the former one, this is because both the IE browsers are using the same session id. It's happening because of session sharing of IE8. There is only one session maintained for one application however how many users I am logging in. In fact I want to mantain on session per user.
Like when I am logging in Gmail in one browser. If I am just typing Gmail on another browser. It's logging in automatically. I don't want this in my application. I should get login by another user at a time I should perform independent operation.
My application uses Struts, Spring, Hibernate & JBoss application server.
Now tell me how I should proceed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为您上面描述的问题可以在所有浏览器上复制,并且可以在服务器端得到更好的解决。我知道的一种方法是创建一个对话 ID 并使用状态机管理对话的生命周期。
这使您(和您的用户)可以在一个会话中同时进行多个对话,这种情况在实践中经常发生,至少在内部企业应用程序中是这样。世界比业务流程模型所显示的更加混乱。
I think the issues you describe above can be replicated on all browsers and can be better tackled server side. One approach I know of is to create a conversation id and manage the lifecycle of the conversation with a statemachine.
This allows you (and your users) to have one sesion where multiple conversations can be held concurently, which happens a lot in practice, well, at least in internal enterprise applications. The world is a more chaotic place than the business process models let show.
最好的选择可能是使用支持多个并发会话(有时称为对话或流)的 Web 框架,或者只是避免过多使用会话并进行 REST。如果您需要在客户端上破解它,您将无法从您的网络应用程序中执行此操作,但自定义 win 程序或 .reg 文件可以做到这一点。这也意味着使用其他操作系统和浏览器的用户仍然会遇到同样的问题。
Your best bet is probably to use a web framework which supports multiple concurrent sessions (somtimes called conversations or flows), or just avoid using the session so much and go REST. If you need to hack it on the client, you would not be able to do it from your webapp, but a custom win program or a .reg file could do it. This also means that users with other OSs and browsers will still run into the same problem.
我不喜欢提供的所有其他解决方案。我唯一想要的就是提供一个用户可以单击的 URL,它会获得一个新的会话来登录。
有一个明确的 sessionAuthentication 函数,但不是 openLinkInNewSessionWindow
针对 IE8 浏览器的解决方法,您可以在“多重登录”页面上提供一个链接,并使用浏览器中丑陋的 WScript。一个例子:
测试:
将示例保存在sampleNewSession.html中,用IE8打开该文件,在gmail的新选项卡中登录,按sampleNewSession中的链接。现在有一个新窗口并且未登录。
这将对用户有所帮助,只需单击链接即可。唯一的问题是 activeX 安全消息。
I did not like al the other solutions provided. The only thing I want is to provide a URL that the user can click and it gets a new session to login.
There is a clear sessionAuthentication function but not a openLinkInNewSessionWindow
A work around for IE8 browser you could provide a link on the page "multiple login" and use the ugly WScript from the browser. An example:
Test:
Save the example in sampleNewSession.html, open the file with IE8, in a new tab login in gmail, press the link in sampleNewSession. Now there is a new window and not logged in.
This will help the user, it can just click a link. The only problem is the activeX security message.
尝试在客户端维护会话 ID。例如,在 JSP 级别。然后将其发送回服务器组件并尝试跟踪它。假设接收到的会话当前正在服务器端进行,则通过同步或类似的等待机制保持一段时间。我希望这种会话问题能够得到棘手的解决。
Try to maintain the session id at client side. For example, at the JSP level. Then send it back to the server component and try tracking it. Say if the session received is in progress currently at server side, then hold for some time by synchronizing or a similar waiting mechanism. I hope this kind of session issues should be solved tricky.