This mean that session expired. You may prevent it by a4j:poll usage. Or handle it with onExpired function redefinition. Check dev guide for more details.
I use a4j:poll in my page.
Where I have to redefine the function onExpired ?
How can I restore the view state with this function ?
try to look here.
There is a link to a chapter where client handlers described.
I can redifine the js function A4J.AJAX.onExpired. thanks.
But I don't understand why the session has expired.
The session expires because of a timeout or something else ?
Can I set a param to disable the timeout ?
You may look and change for the timeout value in your web.xml. Or use a4j:poll which will be generate a request once to the timeout time.
"Or use a4j:poll which will be generate a request once to the timeout time"
But if the session has expired, I can't send a request ?
And how can I restore the session ?
Session will not be expired if the poll will periodically send a request. :)
to restore you may just reload page in you? handler or for example redirect the user to the main default page.
I was also getting view state could not be restored when my session had definitely NOT timed out. My timeouts are set at 30 minutes, and the view state issue would occur at any time. This was particularly problematic over slow connections (hitting servers in other countries, over VPN, etc). Here is how I solved nearly every case of the problem, although it still very rarely happens.
Add the following attributes to your a4j tags:
timeout="240000" (4 minutes, less may work - I put it this high purely from frustration)
requestDelay="250" (1/4 second, you may need to increase it - higher times = slower response times since it waits at least this long before submitting requests)
These added attributes worked for me. I hope they help you as well.
About redefine the onExpired method, where should I put this method? Could you show me?