日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Chrome开发者工具Network标签页中观察到的set-cookie jsessionid是什么东西

發(fā)布時間:2023/12/19 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Chrome开发者工具Network标签页中观察到的set-cookie jsessionid是什么东西 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在Chrome開發(fā)者工具里經常能觀察到HTTP響應里包含的字段:

Set-Cookie: JSESSIONID= XXX

之后,就能在客戶端cookie里觀察到JSESSIONID=后面的值。

根據Google搜索的結果:
https://javarevisited.blogspot.com/2012/08/what-is-jsessionid-in-j2ee-web.html

這篇博客有詳細介紹:

What is JSESSIONID in JSP-Servlet

JSESSIONID是由Servlet容器比如Tomcat或Jetty等生成的,用于基于HTTP協(xié)議的J2EE web應用中進行session管理。

因為HTTP是一種無狀態(tài)的協(xié)議,Web服務器無法區(qū)分來自同一個客戶端的兩個不同請求,因此需要Session管理機制,具體實現有Cookie和URL Rewriting等。

JSESSIONID is a cookie generated by Servlet containers like Tomcat or Jetty and used for session management in J2EE web application for HTTP protocol. Since HTTP is a stateless protocol there is no way for Web Server to relate two separate requests coming from the same client and Session management is the process to track user session using different session management techniques like Cookies and URL Rewriting.

采用Cookie會話管理的服務器會在客戶端第一次請求時生成JSESSIONID,然后返回給客戶端。客戶端隨后每次請求都會把這個JSESSIONID附在HTTP請求頭部。

比如我們下面這個例子,是不是看到了前面出現在HTTP response set-cookie字段里的JSESSIONID值,在第二個接下來的請求里出現在HTTP request field上了?

If a Web server is using a cookie for session management it creates and sends JSESSIONID cookie to the client and then the client sends it back to the server in subsequent HTTP requests. JSESSIONID and session management is a not only a popular Servlet interview question but also appear in various JSP interviews. Along with What is JSESSIONID interviewer are also interested in when and howJSESSIONID is created in Servlet and JSP which we will see in next section.

如果客戶端瀏覽器禁掉了cookie,那么服務器仍然可以生成JSESSIONID,只不過以URL重寫的技術,把這個JSESSIONID值傳回客戶端:

https://localhost:8443/supermart/login.htm;jsessionid=1A530637289A03B07199A44E8D531427

要獲取更多Jerry的原創(chuàng)文章,請關注公眾號"汪子熙":

總結

以上是生活随笔為你收集整理的Chrome开发者工具Network标签页中观察到的set-cookie jsessionid是什么东西的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。