- 

Available since OmniFaces 3.9

The ExceptionSuppressor will suppress all exceptions which are an instance of the types as listed in context parameter "org.omnifaces.EXCEPTION_TYPES_TO_SUPPRESS" and refresh the current page by redirecting to the current URL with query string. The context parameter value must be a commaseparated string of fully qualified names of exception types. Note that this also covers subclasses of specified exception types.

<context-param>
    <param-name>org.omnifaces.EXCEPTION_TYPES_TO_SUPPRESS</param-name>
    <param-value>java.nio.channels.ClosedByInterruptException,java.nio.channels.IllegalSelectorException</param-value>
</context-param>

This is useful for exceptions which are technically unavoidable such as those which boil down to that the network connection is abruptly closed by the client by e.g. navigating away while the page is loading, or closing the browser window/tab while the page is loading, or having the physical network connection cut down, or the physical machine crashed, etcetera. All which are beyond control of the server and therefore not really interesting to have logged into server logs.

Installation

This handler must be registered by a factory as follows in faces-config.xml in order to get it to run:

<factory>
    <exception-handler-factory>org.omnifaces.exceptionhandler.ExceptionSuppressorFactory</exception-handler-factory>
</factory>

In case there are multiple exception handlers, best is to register this handler as last one in the chain. For example, when combined with FullAjaxExceptionHandler, this ordering will prevent the FullAjaxExceptionHandler from taking over the handling of the to-be-suppressed exceptions.

<factory>
    <exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
    <exception-handler-factory>org.omnifaces.exceptionhandler.ExceptionSuppressorFactory</exception-handler-factory>
</factory>