Package javax.faces.context

Examples of javax.faces.context.ExceptionHandler


    this.factory = new SpringExceptionHandlerFactory(this.delegate);
  }

  @Test
  public void shouldWrapExceptionHandler() throws Exception {
    ExceptionHandler exceptionHandler = mock(ExceptionHandler.class);
    given(this.delegate.getExceptionHandler()).willReturn(exceptionHandler);
    ExceptionHandler actual = this.factory.getExceptionHandler();
    assertThat(actual, is(SpringExceptionHandler.class));
    assertThat(((SpringExceptionHandler) actual).getWrapped(), is(sameInstance(exceptionHandler)));
    // Check that the delegate is called
    actual.handle();
    verify(exceptionHandler).handle();
  }
View Full Code Here


   *
   * @see javax.faces.context.ExceptionHandlerFactory#getExceptionHandler()
   */
  public ExceptionHandler getExceptionHandler() {

    ExceptionHandler exceptionHandler = this.original.getExceptionHandler();
    HDIVExceptionHandler hdivExHandler = new HDIVExceptionHandler(exceptionHandler);
    return hdivExHandler;
  }
View Full Code Here

    @Override
    public ExceptionHandler getExceptionHandler()
    {
        lazyInit();

        ExceptionHandler exceptionHandler = this.wrappedFacesContext.getExceptionHandler();

        if (this.defaultErrorViewExceptionHandlerActivated)
        {
            exceptionHandler = new DefaultErrorViewAwareExceptionHandlerWrapper(exceptionHandler);
        }
View Full Code Here

     */
    public ExceptionHandler getExceptionHandler() {
        FacesContext fc = FacesContext.getCurrentInstance();
        ApplicationAssociate myAssociate = getAssociate(fc);

        ExceptionHandler result = new AjaxNoAjaxExceptionHandler(
                new AjaxExceptionHandlerImpl(new ExceptionHandlerImpl(Boolean.TRUE)),
                new ExceptionHandlerImpl(((myAssociate != null) ? myAssociate.isErrorPagePresent() : Boolean.TRUE)));
        return result;

    }
View Full Code Here

  protected Throwable getJSF2HandledException(FacesContext facesContext) {

    Throwable handledException = null;

    ExceptionHandler exceptionHandler = facesContext.getExceptionHandler();
    Iterable<ExceptionQueuedEvent> handledExceptionQueuedEvents =
      exceptionHandler.getHandledExceptionQueuedEvents();

    if (handledExceptionQueuedEvents != null) {
      Iterator<ExceptionQueuedEvent> itr = handledExceptionQueuedEvents.iterator();

      while (itr.hasNext()) {
View Full Code Here

  }

  protected Throwable getJSF2UnhandledException(FacesContext facesContext) {

    Throwable unhandledException = null;
    ExceptionHandler exceptionHandler = facesContext.getExceptionHandler();
    Iterable<ExceptionQueuedEvent> unhandledExceptionQueuedEvents =
      exceptionHandler.getUnhandledExceptionQueuedEvents();

    if (unhandledExceptionQueuedEvents != null) {
      Iterator<ExceptionQueuedEvent> itr = unhandledExceptionQueuedEvents.iterator();

      while (itr.hasNext()) {
View Full Code Here

  }

  @Override
  public ExceptionHandler getExceptionHandler() {

    ExceptionHandler wrappedExceptionHandler = wrappedExceptionHandlerFactory.getExceptionHandler();
    FacesContext facesContext = FacesContext.getCurrentInstance();

    if (facesContext.getPartialViewContext().isAjaxRequest()) {
      return new ExceptionHandlerAjaxImpl(wrappedExceptionHandler);
    }
View Full Code Here

        this.parent = parent;
    }

    @Override
    public ExceptionHandler getExceptionHandler() {
        ExceptionHandler eh = new DefaultExceptionHandler(parent.getExceptionHandler());
        return eh;
    }
View Full Code Here

    }
   
    private FacesContext _createFacesContext(ServletContext servletContext, boolean startup)
    {
        ExternalContext externalContext = new StartupServletExternalContextImpl(servletContext, startup);
        ExceptionHandler exceptionHandler = new ExceptionHandlerImpl();
        FacesContext facesContext = new StartupFacesContextImpl(externalContext,
                (ReleaseableExternalContext) externalContext, exceptionHandler, startup);
       
        // If getViewRoot() is called during application startup or shutdown,
        // it should return a new UIViewRoot with its locale set to Locale.getDefault().
View Full Code Here

public class ExceptionHandlerPhaseListener implements PhaseListener {

  @Override
  public void afterPhase(PhaseEvent event) {
    FacesContext context = event.getFacesContext();
    ExceptionHandler handler = context.getExceptionHandler();
   
    Iterator<ExceptionQueuedEvent> events = handler.getUnhandledExceptionQueuedEvents().iterator();
    while(events.hasNext()){
      ExceptionQueuedEvent exceptionEvent = events.next();
      ExceptionQueuedEventContext eventContext = exceptionEvent.getContext();
      Throwable ex = eventContext.getException();
     
View Full Code Here

TOP

Related Classes of javax.faces.context.ExceptionHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.