weblogic10.3中三種配置會話超時的方法

db_wjw發表於2012-11-28

weblogic10.3中三種配置會話超時的方法如下:

1、The File web.xml

Edit the session-timeout of the session-config in the file web.xml. Please note in web.xml, the session timeout is set in minutes.


 60


IMPORTANT:
The timeout value set in web.xml takes precedence over weblogic.xml. If you don't set any values in web.xml, weblogic.xml takes over. A good approach to handle session timeout is setting this just on web.xml itself since web.xml takes precedence over application server’s deployment descriptors.


2、The File weblogic.xml

Edit the session-param TimeoutSecs in the file weblogic.xml. In weblogic.xml, the session timeout is set in seconds.


 
  TimeoutSecs
  3600
 




3、Application Code

Setting this parameter by java code on your servlet or JSP file. This is a method in the public interface HttpSession.

Public void setMaxInactiveInterval(int interval)

Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.

Public int getMaxInactiveInterval()

Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method. A negative time indicates the session should never timeout.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26194851/viewspace-750105/,如需轉載,請註明出處,否則將追究法律責任。

相關文章