I am using OmniFaces (1.7) FullAjaxExceptionHandler to handle (ViewExpired)Exception's during ajax requests.
I don't want to the FullAjaxExceptionHandler to log the exception with level SEVERE as the default implementation does. So I did override the logException method, but still the default method rather than the overridden one is called.
I have registered the following factories:
<factory>
<exception-handler-factory>my.package.ViewExpiredExceptionHandlerFactory</exception-handler-factory>
</factory>
<factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
</factory>
Here is my ViewExpiredExceptionHandlerFactory
public class ViewExpiredExceptionHandlerFactory extends ExceptionHandlerFactory {
private ExceptionHandlerFactory parent;
public ViewExpiredExceptionHandlerFactory(ExceptionHandlerFactory parent) {
this.parent = parent;
}
@Override
public ExceptionHandler getExceptionHandler() {
ExceptionHandler result = parent.getExceptionHandler();
result = new ViewExpiredExceptionHandler(result);
return result;
}
}
and the extended FullAjaxExceptionHandler
public class ViewExpiredExceptionHandler extends FullAjaxExceptionHandler {
private static final Logger LOGGER = Logger.getLogger(ViewExpiredExceptionHandler.class);
private ExceptionHandler wrapped;
public ViewExpiredExceptionHandler(ExceptionHandler wrapped) {
super(wrapped);
this.wrapped = wrapped;
}
@Override
public ExceptionHandler getWrapped() {
return this.wrapped;
}
@Override
public void logException(FacesContext context, Throwable exception, String location, String message, Object... parameters) {
String user = UserFilter.readUserIdFromSession();
LOGGER.info("The view/session has expired for user " + (user == null ? "null" : user));
}
}
Am I missing something?