I have a standard J2EE web-application running on WebLogic server. I want to handle a session timeout through the meta-data setup in web.xml. I tried to use the following setting
<error-page>
<error-code>408</error-code>
<location>/jsp/testErrorPage.jsp</location>
</error-page>
However it didn't work.
Best Answer
Below is the explanation for 408 request timeout,
For eg., lets say you are trying to login. But, because of some reasons there is no receipt of any data. Then there is a 408 request timeout.
But in your case you are trying to handle a session timeout. It means, client has not established a connection with the server for a particular period of time (for eg., 30 mins). Means, you are idle without doing any activity for 30 mins. This is the meaning of session-timeout.
For handling session timeout, you must have below code in your web.xml
Above code indicates that if you are idle for 30 mins, your session will be destroyed.
Also, you must write a custom listener which implements HttpSessionListener and configure it as a listeners in your
web.xml
This code will be executed when your session times out. You can try to redirect to your error page inHttpSessionListener#sessionDestroyed
method.If this solution was not what you were looking for, but instead you are looking for actually solving root cause of 408 error, then fixing 408 errors page might be helpful.