public void onBeforeAccessDeniedException( @BeforeHandles ExceptionEvent<AccessDeniedException> event) { if (!this.isActive) { return; } event.throwOriginal(); }
protected final <T extends Throwable> void handle( ExceptionEvent<T> event, LogLevel logLevel, String redirectUrl, FacesMessage.Severity severity, String messageKey, Object... messageArgs) { logException(logLevel, event.getException()); if (ContextUtils.isContextActive(WindowScoped.class)) { messages.clear(); messages.addFromResourceBundle(severity, messageKey, messageArgs); urlUtil.redirectTo(redirectUrl); // TODO urlUtil.forwardTo(redirectPath); // required - "stops" the JSF lifecycle FacesContext.getCurrentInstance().responseComplete(); } // no other ExceptionHandler should handle this exception... event.handled(); }
void showFacesMessage(@Handles @WebRequest ExceptionEvent<Throwable> evt) { FacesContext.getCurrentInstance() .addMessage(null, new FacesMessage(evt.getException().getMessage())); evt.handledAndContinue(); }