当前位置:网站首页>Basic usage, principle and details of session
Basic usage, principle and details of session
2022-07-01 04:36:00 【Rain |】
Session tracking technology stored on the server
JavaEE Provide HttpSession Interface ,Session Similar to a domain on the server
Basic use :
establish Session object :
HttpSession session = request.getSession()
session.setAttribute(String name,Object o) Store in Session domain
session.getAttribute(String name) Get by key Session Data in domain
session.removeAttribute(String name) Delete Session Data in domain
Case study :


principle :
Session Is based on Cookie Realized , Exists in the program Session when ,Tomcat Will automatically detect , And create the corresponding response header set-Cookie:JSSESSIONID = ... Send it to the browser , The browser wants to access Session The request header will be issued when the domain Cookie: JSSESSIONID = …, Not like Cookie Send data directly .

details :
Session Activation of , passivation :
Session It will not disappear immediately after the server is shut down normally ,
passivation :
When the server is shut down normally ,Session Store the data in the hard disk of the server ,target/work Under the folder
activation :
When the server starts again ,Session Re extract the data stored in the hard disk Session data , establish Session Domain , Delete the files stored on the hard disk
Session Survival time :
The default is 30 minute
It can be configured in Web.xml Configure lifetime
<session-config>
<session-timeout>90</session-timeout>
</session-config>
Delete Session:
session.invalidate();
effect : Exit account
边栏推荐
- Extension fragment
- 2022 t elevator repair new version test questions and t elevator repair simulation test question bank
- 2022 G2 power station boiler stoker examination question bank and G2 power station boiler stoker simulation examination question bank
- 【发送邮件报错】535 Error:authentication failed
- Haskell lightweight threads overhead and use on multicores
- js 图片路径转换base64格式
- [untitled]
- Registration of P cylinder filling examination in 2022 and analysis of P cylinder filling
- This may be your last chance to join Tencent
- Jenkins automatically cleans up construction history
猜你喜欢

2022 G2 power station boiler stoker examination question bank and G2 power station boiler stoker simulation examination question bank

It's settled! 2022 JD cloud summit of JD global technology Explorer conference see you in Beijing on July 13

【LeetCode】100. Same tree
![[ue4] event distribution mechanism of reflective event distributor and active call event mechanism](/img/44/6a26ad24d56ddd5156f3a31fa7e0b9.jpg)
[ue4] event distribution mechanism of reflective event distributor and active call event mechanism

2022.2.7-2.13 AI industry weekly (issue 84): family responsibilities

VR线上展览所具备应用及特色

Maixll-Dock 快速上手

NFT: start NFT royalty journey with eip-2981

Daily algorithm & interview questions, 28 days of special training in large factories - the 13th day (array)

LM小型可编程控制器软件(基于CoDeSys)笔记二十:plc通过驱动器控制步进电机
随机推荐
After many job hopping, the monthly salary is equal to the annual salary of old colleagues
细数软件研发效能的七宗罪
Measurement of quadrature axis and direct axis inductance of three-phase permanent magnet synchronous motor
Account sharing technology enables the farmers' market and reshapes the efficiency of transaction management services
Tencent has five years of testing experience. It came to the interview to ask for 30K, and saw the so-called software testing ceiling
2022危险化学品生产单位安全生产管理人员题库及答案
What is uid? What is auth? What is a verifier?
【发送邮件报错】535 Error:authentication failed
Caijing 365 stock internal reference | the first IPO of Beijing stock exchange; the subsidiary of the recommended securities firm for gambling and gambling, with a 40% discount
ThreeJS开篇
[Master / slave] router election in DD message
One job hopping up 8K, three times in five years
Day 52 - tree problem
2022年T电梯修理题库及模拟考试
JVM栈和堆简介
JS image path conversion Base64 format
Why is Hong Kong server most suitable for overseas website construction
206. reverse linked list
2022 t elevator repair question bank and simulation test
js 图片路径转换base64格式