This wiki does not contain official documentation and is currently deprecated and read only. Please try reading the documentation on the Liferay Developer Network, the new site dedicated to Liferay documentation. DISCOVER Build your web site, collaborate with your colleagues, manage your content, and more. DEVELOP Build applications that run inside Liferay, extend the features provided out of the box with Liferay's APIs. DISTRIBUTE Let the world know about your app by publishing it in Liferay's marketplace. PARTICIPATE Become a part of Liferay's community, meet other Liferay users, and get involved in the open source project. Session Timeout
Introduction #
Session timeout is an expired time limit for a logged in Liferay user which as been inactive for a period of time.
Changing the Session Timeout Period #
There are two files that affect the length of a session timeout, which are
web.xml
, and portal.properties.
The
web.xml
is located under
/WEB-INF
. The xml element that contains the session timeout is
<session-config> <session-timeout>30</session-timeout> </session-config>
The portal.properties file is located under
/portal/portal-impl/classes
. The property containing the session timeout is:
session.timeout=30
There is also a setting for a warning prior to the session timeout, which is in located in
portal.properties
under
session.timeout.warning=1
By changing this period, the timeout will increase or decrease accordingly.
Note: Session timeout values are in minutes.
Precedence #
The
web.xml
setting takes precedence over
portal.properties
.
This can be seen under
MainServlet.java
under the
_checkWebSettings()
method.
private void _checkWebSettings(String xml) throws DocumentException {
SAXReader reader = SAXReaderFactory.getInstance(false);
Document doc = reader.read(new StringReader(xml));
Element root = doc.getRootElement();
int timeout = GetterUtil.getInteger(
PropsUtil.get(PropsUtil.SESSION_TIMEOUT));
Element sessionConfig = root.element("session-config");
if (sessionConfig != null) {
String sessionTimeout =
sessionConfig.elementText("session-timeout");
timeout = GetterUtil.getInteger(sessionTimeout, timeout);
}
PropsUtil.set(PropsUtil.SESSION_TIMEOUT, Integer.toString(timeout));
}MainServlet.java
sets the session timeout to
PropsUtil.SESSION_TIMEOUT
.
What Uses the Session Timeout? #
session_timeout.jsp
uses the timeout to set a decreasing counter that will eventually timeout after a period of time. The file is located under
/html/common/themes
.
session_timeout
will call
PropsUtil.SESSION_TIMEOUT
to set the timeout. After the timeout is set, the code determines when a warning appears and when to terminate the session due to inactivity.
session_timeout.jsp
is usually called in a theme in a
portal_normal
file.
Note: In the session_timeout.jsp
uses the timeout in millisecond instead of minutes. (1 minute = 60000 milliseconds)