Friday, March 21

How to Configure Session Timeout in Weblogic Server?



There are three ways to set a web application session timeout parameter on WebLogic Server (WLS).

The File web.xml

1) 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


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.

No comments:

Post a Comment