当前位置:网站首页>Cookie operation
Cookie operation
2022-07-05 07:20:00 【Sun Tianyang】
1. take cookie Back to the browser
// Create a Cookie
Cookie cookie = new Cookie(“cookieName”);
// Settings are readable only by browsers
cookie.setHttpOnly(true);
// Set retention duration -1 Means not to delete
cookie.setMaxAge(-1);
// Set up cookie Reserved path , It can be shared in the same application server
cookie.setPath("/")
response.addCookie(cookie);
2. obtain cookie
Cookie[] cookies = request.getCookie();
if(cookies == null || cookies.length == 0) {
return null;
}
for(Cookie cookie : cookies) {
if(“cookieName”.equals(cookie.getName())) {
return cookie.getValue();
}
}
return null;
边栏推荐
- Simple operation of running water lamp (keil5)
- IPage能正常显示数据,但是total一直等于0
- Database SQL practice 4. Find the last of employees in all assigned departments_ Name and first_ name
- 2022.06.27_ One question per day
- [vscode] search using regular expressions
- Steps and FAQs of connecting windows Navicat to Alibaba cloud server MySQL
- HDU1231 最大连续子序列(分治or动规or双指针)
- Ros2 - workspace (V)
- An article was opened to test the real situation of outsourcing companies
- Use of Pai platform
猜你喜欢
SD_ CMD_ SEND_ SHIFT_ REGISTER
【软件测试】02 -- 软件缺陷管理
[software testing] 04 -- software testing and software development
Intelligent target detection 59 -- detailed explanation of pytoch focal loss and its implementation in yolov4
【Node】nvm 版本管理工具
Hdu1232 unimpeded project (and collection)
[vscode] prohibit the pylance plug-in from automatically adding import
Concurrent programming - deadlock troubleshooting and handling
Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘
Rough notes of C language (1)
随机推荐
纯碱是做什么的?
Unity ugui how to match and transform coordinates between different UI panels or uis
Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required
氫氧化鈉是什麼?
MySQL setting trigger problem
[node] differences among NPM, yarn and pnpm
Interpretation of the earliest sketches - image translation work sketchygan
Literacy Ethernet MII interface types Daquan MII, RMII, smii, gmii, rgmii, sgmii, XGMII, XAUI, rxaui
[software testing] 03 -- overview of software testing
1290_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
苏打粉是什么?
The difference between new and malloc
Don't confuse the use difference between series / and / *
[framework] multi learner
Mid 2022 documentary -- the experience of an ordinary person
Machine learning Seaborn visualization
Brief description of inux camera (Mipi interface)
ImportError: No module named ‘Tkinter‘
[vscode] search using regular expressions
Implementation of one-dimensional convolutional neural network CNN based on FPGA (VIII) implementation of activation layer