public void onBeforeAccessDeniedException(
     @BeforeHandles ExceptionEvent<AccessDeniedException> event) {
   if (!this.isActive) {
     return;
   }
   event.throwOriginal();
 }
コード例 #2
0
  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();
  }
コード例 #3
0
 void showFacesMessage(@Handles @WebRequest ExceptionEvent<Throwable> evt) {
   FacesContext.getCurrentInstance()
       .addMessage(null, new FacesMessage(evt.getException().getMessage()));
   evt.handledAndContinue();
 }