If you speak about the situation with session expirared during the ajax request, it is key moment that the request itself is posted by the XMLHTTPRequest object, but not from the browser. The object expects to receive the XML from the server. So, it does not help if you write a filter and send the redirected page. The object just does not understand this "gift".
See Section 5.2.2 at:
The idea is overwriting this A4J.AJAX.onExpired function and performing a redirect (using document.location="...."). Such redirect will be sent behalf of the browser itself, so the user will see the redirect page then.