小风儿 发表于 2015-8-7 12:48:14

Tomcat/weblogic session失效时间的几种设置方法

一、在容器中设置
tomcat中配置server.xml中定义context时采用如下定义:  
  weblogci中设置weblogic特有部署描述符weblogic.xml的元素的
timeoutsecs 属性。这个值以秒为单位


timeoutsecs
2600


默认值是2600秒
  二、web应用设置,优先级比容器中高
  设置web应用程序描述符web.xml里的元素。这个值以分钟为
单位,并覆盖 weblogic.xml中的timeoutsecs属性

24

此例表示session将在24分钟后过期 ,默认设置是30分钟
当设置为-2,表示将使用在weblogic.xml中设置的
timeoutsecs这个属性值。
当设置为-1,表示session将永不过期,而忽略在
weblogic.xml中设置的timeoutsecs属性值。
该属性值可以通过console控制台来设置
  
  三、应用代码中设置,优先级最高
  jsp中控制
session.setmaxinactiveinterval(7200);
session是默认对象,可以直接引 用,单位秒s
4,servlet中控制
httpsession session = request.getsession();
session.setmaxinactiveinterval(7200);
单位秒 s
页: [1]
查看完整版本: Tomcat/weblogic session失效时间的几种设置方法