Package javax.faces.event

Examples of javax.faces.event.ExceptionQueuedEvent


            do
            {
                // For each ExceptionEvent in the list
               
                // get the event to handle
                ExceptionQueuedEvent event = unhandled.peek();
                try
                {
                    // call its getContext() method
                    ExceptionQueuedEventContext context = event.getContext();

                    if (facesContext == null)
                    {
                        facesContext = event.getContext().getContext();
                    }
                   
                    // and call getException() on the returned result
                    Throwable exception = context.getException();
                   
View Full Code Here


    {
        if (_isAjaxRequest == null)
        {
            if (exceptionQueuedEvent instanceof ExceptionQueuedEvent)
            {
                ExceptionQueuedEvent eqe = (ExceptionQueuedEvent)exceptionQueuedEvent;
                ExceptionQueuedEventContext eqec = eqe.getContext();
                if (eqec != null)
                {
                    FacesContext facesContext = eqec.getContext();
                    if (facesContext != null)
                    {
View Full Code Here

     * @see javax.faces.context.ExceptionHandlerWrapper#handle()
     */
    public void handle() throws FacesException {

        for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext(); ) {
            ExceptionQueuedEvent event = i.next();
            ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
            try {
                Throwable t = context.getException();
                if (isRethrown(t)) {
                    handled = event;
                    t.printStackTrace();
View Full Code Here

     */
    @SuppressWarnings({"ThrowableInstanceNeverThrown"})
    public void handle() throws FacesException {

        for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext(); ) {
            ExceptionQueuedEvent event = i.next();
            ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
            try {
                Throwable t = context.getException();
                if (isRethrown(t)) {
                    handled = event;
                    Throwable unwrapped = getRootCause(t);
View Full Code Here

    @Override
    public void handle() throws FacesException {

        Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator();
        while (i.hasNext()) {
            ExceptionQueuedEvent event = i.next();
            Throwable t = getThrowable(event);

            Throwable unauthorized = getUnauthorizedException(t);
            if (unauthorized != null) {
                try {
View Full Code Here

    @Override
    public void handle() throws FacesException {

        Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator();
        while (i.hasNext()) {
            ExceptionQueuedEvent event = i.next();
            ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();

            // get the exception from context
            Throwable t = context.getException();

            Throwable businessException = getBusinessException(t);
View Full Code Here

    {
        //handle exceptions which occur in a phase-listener (beforePhase) for PhaseId.RENDER_RESPONSE
        //needed because #handle gets called too late in this case
        if (event instanceof ExceptionQueuedEvent)
        {
            ExceptionQueuedEvent exceptionQueuedEvent = (ExceptionQueuedEvent)event;
            FacesContext facesContext = exceptionQueuedEvent.getContext().getContext();

            if (facesContext.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE &&
                exceptionQueuedEvent.getContext().inBeforePhase())
            {
                Throwable exception = getRootCause(exceptionQueuedEvent.getContext().getException());

                if (exception instanceof AccessDeniedException)
                {
                    processAccessDeniedException(exception);
                }
View Full Code Here

  }

  @Test
  public void shouldCallHandlersInOrderForEachEvent() throws Exception {
    Exception exception1 = new Exception();
    ExceptionQueuedEvent event1 = new ExceptionQueuedEvent(new ExceptionQueuedEventContext(this.facesContext,
        exception1));
    Exception exception2 = new Exception();
    ExceptionQueuedEvent event2 = new ExceptionQueuedEvent(new ExceptionQueuedEventContext(this.facesContext,
        exception2));
    this.events.add(event1);
    this.events.add(event2);
    this.exceptionHandler.handle();
    InOrder ordered = inOrder(this.handler1, this.handler2, this.handler3);
View Full Code Here

  }

  @Test
  public void shouldRemoveEventOnHandle() throws Exception {
    Exception exception = new Exception();
    ExceptionQueuedEvent event = new ExceptionQueuedEvent(new ExceptionQueuedEventContext(this.facesContext,
        exception));
    this.events.add(event);
    given(this.handler1.handle(exception, event)).willReturn(true);
    this.exceptionHandler.handle();
    assertThat(this.events.size(), is(0));
View Full Code Here

  }

  @Test
  public void shouldNotCallSubsequentHandlers() throws Exception {
    Exception exception = new Exception();
    ExceptionQueuedEvent event = new ExceptionQueuedEvent(new ExceptionQueuedEventContext(this.facesContext,
        exception));
    this.events.add(event);
    given(this.handler2.handle(exception, event)).willReturn(true);
    this.exceptionHandler.handle();
    verify(this.handler3, never()).handle(exception, event);
View Full Code Here

TOP

Related Classes of javax.faces.event.ExceptionQueuedEvent

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.