简体   繁体   中英

new session for every request

在我的项目中,要求每个请求都应该有新的会话,但是如果我们在多个选项卡中击中相同的URL或两次打开同一浏览器并击中该URL,则将其视为一个会话,并且结果会不一致。ie中有一些设置解决我的问题的浏览器,但我想知道是否可以通过编程方式完成。我使用struts 1.3。

I really think that you should take another approach to solve this problem, more on the client side than the server side or maybe mixing both. Off the top of my head I can think on generating a unique ID on javascript each time you load the page (meaning open another tab) and keep this ID as a tab identifier, then you could use these ids on your server side to match the information for each page. Why this should be like this? Because http servers doesn't know anything about browser tabs, they "statelessly" receive requests and send responses and sessions are kind of artificial, they're just tracked by a simple cookie sent from and to the browser which helps the server to know who is talking to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM