miercuri, 15 aprilie 2015

[OmniFaces utilities (2.0)] Get/set the HTTP session timeout in seconds


[OmniFaces utilities] The getSessionMaxInactiveInterval() method returns the HTTP session timeout in seconds. This implicitly creates the session if one doesn't exist.
[OmniFaces utilities] The setSessionMaxInactiveInterval() method sets the HTTP session timeout in seconds. A value of 0 or less means that the session should never timeout.

Method Faces#getSessionMaxInactiveInterval() - get the HTTP session timeout in seconds:

Method Faces#setSessionMaxInactiveInterval() - set the HTTP session timeout in seconds:
Usage:

import org.omnifaces.util.Faces;
...
// default HTTP session timeout, e.g. 1800
int interval = Faces.getSessionMaxInactiveInterval();   

// explicitly set the HTTP session timeout, e.g. 4000
// now the Faces#getSessionMaxInactiveInterval() will return 4000
Faces.setSessionMaxInactiveInterval(4000);

Niciun comentariu:

Trimiteți un comentariu