[英]Java - Does javax.websocket.Session and javax.servlet.http.HttpSession use the same JSESSIONID?
I would like to know if getId() method from javax.websocket.Session and getId() method from javax.servlet.http.HttpSession always share the same JSESSIONID.我想知道javax.websocket.Session 中的getId() 方法和 javax.servlet.http.HttpSession 中的 getId() 方法是否总是共享相同的 JSESSIONID。
NB: I know that those two methods are implementation dependent , and I didn't find a link between those two session id on the internet/documentation.注意:我知道这两种方法依赖于实现,而且我没有在互联网/文档上找到这两个会话 ID 之间的链接。
Goal: A client connects to my website (a JSESSIONID is created) and is authentified by a login/password (client object is linked to the JSESSIONID), then he uses website's chat ... will he be recognized by his session id from the websocket ?目标:客户端连接到我的网站(创建了 JSESSIONID)并通过登录名/密码进行身份验证(客户端对象链接到 JSESSIONID),然后他使用网站的聊天......他会被他的会话 ID 识别吗?网络套接字?
=> If the anwser is "no, it's not always the same", could you propose an alternative solution ? => 如果答案是“不,它并不总是相同的”,您能否提出替代解决方案? Thanks
谢谢
The ids of a websocket Session and a HttpSession
are not related. websocket Session 和
HttpSession
的 id 不相关。
A simple reason is that a client which is associated with a server side HttpSession
can have multiple websocket sessions which all need an own unique id.一个简单的原因是与服务器端
HttpSession
关联的客户端可以有多个 websocket 会话,这些会话都需要一个自己的唯一 ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.