简体   繁体   English

会话ID如何存储在Jersey REST服务中

[英]How session id is stored in Jersey REST service

I know browsers store session ids using cookies and check these ids on each request. 我知道浏览器使用cookie存储会话ID,并在每次请求时检查这些ID。 My question is the following: when you make a REST call from your mobile device (or any other device), how does the client-server communication identify sessions and assign unique session ids to each client? 我的问题如下:当您从移动设备(或任何其他设备)进行REST调用时,客户端与服务器之间的通信如何识别会话并为每个客户端分配唯一的会话ID?

It is not clear wether your question is related to what actually happens to the client side or to the server side. 您的问题是否与客户端或服务器端实际发生的问题有关,目前尚不清楚。

From the (java) web server point of view, a sessionID is just an id, and there are basically 3 ways to communicate with a client and to deal with this ID (so the server knows with which user it is talking with). 从(java)Web服务器的角度来看,sessionID只是一个ID,基本上有3种与客户端通信并处理该ID的方式(因此服务器知道与之交谈的用户)。

  • Url rewriting 网址重写
  • Hidden form input 隐藏表格输入
  • Cookies 饼干

The usage of cookies is not strictly limited to the usage of a web browser as the clientm as any client can put cookies in the HTTP header. Cookie的使用不严格限于作为客户端的Web浏览器,因为任何客户端都可以将Cookie放在HTTP标头中。

If you want to know how a specific client can deal with the server to communicate session information, please be specific about what client you intent to use, because the implementation details (and therefore client code) may vary, even if the general mechanism is identical. 如果您想知道特定的客户端如何与服务器进行通信以交流会话信息,请具体说明您打算使用的客户端,因为即使一般机制相同,实现细节(以及客户端代码)也可能有所不同。 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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