문제

I have a requirement to set the session expiry of my j2ee application as 4 Minute 30 Seconds.

As far as I know, session config section allows only minutes .

<session-config>
    <session-timeout>
        [Minute]
    </session-timeout>
</session-config>

My question is, is it possible to enter decimal values like 4.5 (Equivalent to 4 Miute 30 Seconds)?

  <session-config>
        <session-timeout>
            4.5
        </session-timeout>
    </session-config>
도움이 되었습니까?

해결책 2

After lots of research, I had to accept the fact that only integers are allowed under session-timeout tag . If at all if session expiry to be set in seconds, then only way left is to control it through Java.

To Answer my question, it is NOT possible to set session-expiry by seconds through web.xml

다른 팁

Servlet Specification states the below

The default time out period for sessions is defined by the servlet container and can be obtained via the getMaxInactiveInterval method of the HttpSession interface. This time out can be changed by the Developer using the setMaxInactiveInterval method of the HttpSession interface. The time out periods used by these methods are defined in seconds

And so you should be able to specify the session-timout using setMaxInactiveInterval method.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top