在java中删除会话超时的cookie [英] delete cookies on session timeout in java

查看:308
本文介绍了在java中删除会话超时的cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个java web应用程序,其中我已配置会话超时等于4分钟。此应用程序还使用Cookie。

I am developing a java web application in which I have configured session-timeout to be equal to 4 minutes.This application also uses cookies.

我的问题是在HttpSession过期4分钟后,Cookie仍保留在浏览器中(age设置为-1)。在会话超时后是否有任何方法删除Cookie?

My problem is after 4 minutes of inactivity the HttpSession expires but the cookies remain in the browser (age is set to -1). Is there any way to delete cookies after session timeout?

设置cookie年龄等于4分钟wont help.cookies应在不活动的4分钟后删除。

P.S. setting cookie age equal to 4 minutes wont help.cookies should be deleted after 4 minutes of inactivity .

推荐答案

p>如果您将Cookie年龄设置为4分钟,并在每次服务器发送回复时重置Cookie年龄,则该Cookie会在4分钟不活动后超时。

If you set the cookie age to 4 minutes, and reset the cookie age every time your server sends a response, then the cookie will time out after 4 minutes of inactivity.

这篇关于在java中删除会话超时的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆