/** * <p class="changed_added_2_0">Return the * <code>ExceptionQueuedEventContext</code> for this event instance.</p> * * @since 2.0 * * @return the context */ public ExceptionQueuedEventContext getContext() { return (ExceptionQueuedEventContext) getSource(); }
@Override public void handle() throws FacesException { FacesContext context = FacesContext.getCurrentInstance(); if (context == null || context.getResponseComplete()) { return; Throwable throwable = unhandledExceptionQueuedEvents.next().getContext().getException(); if (context.getApplication().getProjectStage() == ProjectStage.Development) { rootCause.printStackTrace();
(ExceptionQueuedEventContext) exceptionQueuedEventIterator.next().getSource(); Throwable throwable = exceptionQueuedEventContext.getException(); FacesContext facesContext = exceptionQueuedEventContext.getContext(); Flash flash = facesContext.getExternalContext().getFlash(); if(facesContext.getViewRoot() != null) viewId = facesContext.getViewRoot().getViewId(); FacesContext facesContext = exceptionQueuedEventContext.getContext(); UIViewRoot uiViewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId); this.wrapped.handle();
public void handle() throws FacesException { boolean sessionExpired = false; final FacesContext fc = FacesContext.getCurrentInstance(); final ExternalContext ec = fc.getExternalContext(); final Iterator<ExceptionQueuedEvent> exceptionQueuedEventIterator = getUnhandledExceptionQueuedEvents().iterator(); if (exceptionQueuedEventIterator.hasNext()) { for (Iterator<ExceptionQueuedEvent> iter = exceptionQueuedEventIterator; iter.hasNext(); ) { ExceptionQueuedEvent event = iter.next(); ExceptionQueuedEventContext queueContext = (ExceptionQueuedEventContext) event.getSource(); Throwable ex = queueContext.getException(); if (fc.isProjectStage(ProjectStage.Development)) { log.log(Level.WARNING, "queued exception", ex); if (ex instanceof ViewExpiredException && PhaseId.RESTORE_VIEW.equals(queueContext.getPhaseId())) { ViewExpiredException vex = (ViewExpiredException) ex; String viewId = vex.getViewId(); new ExceptionQueuedEventContext(fc, new SessionExpiredException("session expired (causing view to expire)")); app.publishEvent(fc, ExceptionQueuedEvent.class, ctxt); getWrapped().handle();
public void handle() throws FacesException { final Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); while (i.hasNext()) { ExceptionQueuedEvent event = i.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); final FacesContext fc = FacesContext.getCurrentInstance(); final ExternalContext externalContext = fc.getExternalContext(); final ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler(); try { log.error(t.getMessage(), t); performRedirect(externalContext, "/error_service.htm"); fc.renderResponse(); } finally { i.remove(); } } getWrapped().handle(); }
public void handle() throws FacesException { FacesContext fc = FacesContext.getCurrentInstance(); for (Iterator<ExceptionQueuedEvent> iter = getUnhandledExceptionQueuedEvents().iterator(); iter.hasNext(); ) { ExceptionQueuedEvent event = iter.next(); ExceptionQueuedEventContext queueContext = (ExceptionQueuedEventContext) event.getSource(); Throwable ex = queueContext.getException(); //walk back to the original cause of the exception while (ex.getCause() != null) { ex = ex.getCause(); } String redirectURL = mapping.get(ex.getClass()); if (redirectURL != null) { PartialResponseWriter writer = fc.getPartialViewContext().getPartialResponseWriter(); String uri = fc.getApplication().getViewHandler().getResourceURL(fc, redirectURL); try { writer.startDocument(); writer.redirect(uri); writer.endDocument(); fc.responseComplete(); return; } catch (IOException e) { throw new FacesException(e); } } } handler.handle(); }
ExceptionQueuedEventContext context = event.getContext(); facesContext = event.getContext().getContext(); Throwable exception = context.getException(); (context.inBeforePhase() ? "beforePhase() of " : (context.inAfterPhase() ? "afterPhase() of " : "")) + "phase " + context.getPhaseId() + ": " + facesContext = FacesContext.getCurrentInstance(); facesContext = (facesContext == null) ? FacesContext.getCurrentInstance() : facesContext; ExternalContext externalContext = facesContext.getExternalContext();
@Override public void handle() throws FacesException { final FacesContext facesContext = FacesContext.getCurrentInstance(); && facesContext.getPartialViewContext().isAjaxRequest() && getUnhandledExceptionQueuedEvents().iterator().hasNext()) { final Throwable exception = getUnhandledExceptionQueuedEvents().iterator().next().getContext().getException(); && (facesContext.getCurrentPhaseId() != PhaseId.RENDER_RESPONSE || !facesContext.getExternalContext().isResponseCommitted())) { cleanupExceptionQueuedEvents(); } catch (final IOException e) { throw new FacesException(e); getWrapped().handle();
FacesContext facesContext = FacesContext.getCurrentInstance(); facesContext.getExternalContext().getRequestMap().put(ErrorPageWriter.VIEW_KEY, facesContext.getViewRoot()); FacesContext facesContext = FacesContext.getCurrentInstance(); if (e.getCause() instanceof ViewNotFoundException) facesContext.getExternalContext().setResponseStatus(HttpServletResponse.SC_NOT_FOUND); ExceptionQueuedEventContext context = event.getContext(); facesContext = event.getContext().getContext(); Throwable exception = context.getException(); components.add(event.getContext().getComponent());
ExceptionQueuedEventContext context = event.getContext(); Throwable exception = context.getException(); (context.inBeforePhase() ? "beforePhase() of " : (context.inAfterPhase() ? "afterPhase() of " : "")) + "phase " + context.getPhaseId() + ": " + "UIComponent-ClientId=" + throw new FacesException("Could not perform the algorithm to handle the Exception", t);
ExceptionQueuedEvent event = it.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event .getSource(); FacesContext facesContext = FacesContext.getCurrentInstance(); ResourceBundle bundle = facesContext.getApplication() .getResourceBundle(facesContext, "msg"); Throwable t = context.getException(); Throwable cause = ExceptionUtils.getRootCause(t); facesContext.addMessage(null, new FacesMessage( FacesMessage.SEVERITY_ERROR, title, message)); getWrapped().handle();
for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) { ExceptionQueuedEvent event = i.next(); System.out.println("Iterating over ExceptionQueuedEvents. Current:" + event.toString()); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); if (t instanceof ViewExpiredException) { ViewExpiredException vee = (ViewExpiredException) t; fc.getApplication().getNavigationHandler(); try { fc.getExternalContext().getFlash().put("expiredViewId", vee.getViewId()); fc.renderResponse();
ExceptionQueuedEvent event = i.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); try { if (!fc.getExternalContext().isResponseCommitted()) { fc.getExternalContext().redirect("index.xhtml"); fc.renderResponse(); break; } catch (Exception ex) { throw new FacesException(ex); } finally { i.remove();
ExceptionQueuedEvent event = i.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); try { Throwable t = context.getException(); if (isRethrown(t, (context.inBeforePhase() || context.inAfterPhase()))) { handled = event; Throwable unwrapped = getRootCause(t); if (unwrapped != null) { throw new FacesException(unwrapped.getMessage(), unwrapped); } else { if (t instanceof FacesException) { throw (FacesException) t; } else { throw new FacesException(t.getMessage(), t);
while (i.hasNext()) { ExceptionQueuedEvent event = i.next(); ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); Throwable t = context.getException(); FacesContext fc = context.getContext(); boolean exceptionHandled = handleException(t, fc); if(exceptionHandled) i.remove(); // remove from queue return true; } catch (IOException e) { throw new FacesException(e);
@Override public void handle() throws FacesException FacesContext context = FacesContext.getCurrentInstance(); if (context == null || context.getResponseComplete()) Throwable throwable = iterator.next().getContext().getException(); Throwable rootCause = getRootCause(throwable); if (context.getResponseComplete())
Iterator<ExceptionQueuedEvent> itr = unhandledExceptionQueuedEvents.iterator(); FacesContext facesContext = FacesContext.getCurrentInstance(); boolean isDevelopment = facesContext.isProjectStage(ProjectStage.Development); ExceptionQueuedEventContext exceptionQueuedEventContext = exceptionQueuedEvent.getContext(); Throwable throwable = exceptionQueuedEventContext.getException();
@Override public void handle() throws FacesException { FacesContext facesContext = FacesContext.getCurrentInstance(); ExceptionQueuedEventContext exceptionContext; Throwable root; for (Iterator<ExceptionQueuedEvent> iter = getUnhandledExceptionQueuedEvents().iterator(); iter.hasNext();) { exceptionContext = (ExceptionQueuedEventContext) iter.next().getSource(); root = getRoot(exceptionContext.getException()); if (handleException(root, facesContext)) { iter.remove(); } } if (getUnhandledExceptionQueuedEvents().iterator().hasNext()) { getWrapped().handle(); } }
protected void init(SystemEvent exceptionQueuedEvent) { if (!_inited) { if (exceptionQueuedEvent instanceof ExceptionQueuedEvent) { ExceptionQueuedEvent eqe = (ExceptionQueuedEvent)exceptionQueuedEvent; ExceptionQueuedEventContext eqec = eqe.getContext(); if (eqec != null) { FacesContext facesContext = eqec.getContext(); if (facesContext != null) { init(facesContext); return; } } } init(FacesContext.getCurrentInstance()); } }
Throwable exception = unhandledExceptionQueuedEvents.next().getContext().getException(); if (!context.getPartialViewContext().isAjaxRequest()) { throw new FacesException(exception); // Not an ajax request, let default web.xml error page mechanism or FacesExceptionFilter do its job. throw new FacesException(e);