gpt4 book ai didi

java - 是否可以设置 ServletContext 超时?

转载 作者:行者123 更新时间:2023-12-02 08:23:27 24 4
gpt4 key购买 nike

我正在使用上下文来共享登录 session 。我使用 setAttibute 函数。我知道 HttpSession 具有设置最大超时时间的属性。

是否可以以类似的方式设置上下文属性?

ServletContext context = httpservlet.getServletContext();


context.setAttribute("currentSessionUser", username);

谢谢

最佳答案

不要那样做。上下文是应用程序范围内的,当多个用户浏览您的网站时,您会得到非常意外的结果。

关于java - 是否可以设置 ServletContext 超时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5014188/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com