简体   繁体   English

Java - javax.websocket.Session 和 javax.servlet.http.HttpSession 是否使用相同的 JSESSIONID?

[英]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.

相关问题 使javax.servlet.http.HttpSession在某些页面上不超时 - Make javax.servlet.http.HttpSession not timeout on certain pages javax.websocket.Session api - javax.websocket.Session api javax.websocket.Session-getUserProperties()返回的是哪个地图实现? - javax.websocket.Session - which map implementation is getUserProperties() returning? javax.servlet.http.HttpServletRequest 中的 HttpSession 如何工作 - How does HttpSession from javax.servlet.http.HttpServletRequest work 是否可以从javax.websocket.Session实例获取Websocket连接Origin? - Is it possible to get Websocket connection Origin from a javax.websocket.Session instance? 请问javax.servlet.Filter拦截Websocket消息? (Java Servlet API) - Will javax.servlet.Filter intercept Websocket messages? (Java Servlet API) java.lang.NoSuchMethodError: 'javax.servlet.http.HttpServletMapping javax.servlet.http.HttpServletRequest.getHttpServletMapping()' - java.lang.NoSuchMethodError: 'javax.servlet.http.HttpServletMapping javax.servlet.http.HttpServletRequest.getHttpServletMapping()' 使用Intellij Community Edition,出现编译错误“ java:包javax.servlet.http不存在” - Using Intellij Community Edition, getting compile error “java: package javax.servlet.http does not exist” 错误:包javax.servlet.http不存在 - error: package javax.servlet.http does not exist 在 Java 构建路径上找不到超类“javax.servlet.http.HttpServlet” - The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM