当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionQueuedEventContext类代码示例

本文整理汇总了Java中javax.faces.event.ExceptionQueuedEventContext的典型用法代码示例。如果您正苦于以下问题:Java ExceptionQueuedEventContext类的具体用法?Java ExceptionQueuedEventContext怎么用?Java ExceptionQueuedEventContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExceptionQueuedEventContext类属于javax.faces.event包,在下文中一共展示了ExceptionQueuedEventContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    
    for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) {
        ExceptionQueuedEvent event = i.next();
        ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
        Throwable t = context.getException();
        if (t instanceof ViewExpiredException) {
            FacesContext fc = FacesContext.getCurrentInstance();
            NavigationHandler nav = fc.getApplication().getNavigationHandler();
            try {
                nav.handleNavigation(fc, null, "expired?faces-redirect=true&amp;includeViewParams=true");
                fc.renderResponse();
            } finally {
                i.remove();
            }
        }
    }
    // At this point, the queue will not contain any ViewExpiredEvents.
    // Therefore, let the parent handle them.
    getWrapped().handle();

}
 
开发者ID:drifted-in,项目名称:genopro-tools,代码行数:24,代码来源:ViewExpiredExceptionExceptionHandler.java

示例2: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) {
        ExceptionQueuedEvent event = i.next();
        ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();

        Throwable t = context.getException();
        if (t instanceof ViewExpiredException) {
            ViewExpiredException vee = (ViewExpiredException) t;
            FacesContext facesContext = FacesContext.getCurrentInstance();
            Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
            NavigationHandler navigationHandler = facesContext.getApplication().getNavigationHandler();
            try {
                // Push some useful stuff to the request scope for use in the page
                requestMap.put("currentViewId", vee.getViewId());
                navigationHandler.handleNavigation(facesContext, null, "/viewExpired");
                facesContext.renderResponse();
            } finally {
                i.remove();
            }
        }
    }

    // At this point, the queue will not contain any ViewExpiredEvents. Therefore, let the parent handle them.
    getWrapped().handle();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:27,代码来源:ViewExpiredExceptionExceptionHandler-template.java

示例3: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
	Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator();

	while (events.hasNext()) {
		ExceptionQueuedEvent event = events.next();
		ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();

		Throwable exception = context.getException();

		try {
			if (exception instanceof ViewExpiredException) {
                                   HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
                                   FacesContext.getCurrentInstance().getExternalContext().redirect(request.getRequestURI()+"?viewExpired=true");
			}
		} catch (IOException ex) {
                       Logger.getLogger(JsfExceptionHandler.class.getName()).log(Level.SEVERE, null, ex);
                   } finally {
			events.remove();
		}
	}

	getWrapped().handle();
}
 
开发者ID:dsalinux,项目名称:web-ifad,代码行数:25,代码来源:JsfExceptionHandler.java

示例4: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    final Iterator iterator = getUnhandledExceptionQueuedEvents().iterator();
    while (iterator.hasNext()) {
        final ExceptionQueuedEvent event = (ExceptionQueuedEvent) iterator.next();
        final ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
        final Throwable throwable = context.getException();
        final FacesContext fc = FacesContext.getCurrentInstance();
        final ValueExpression valueExpression = fc.getApplication().getExpressionFactory()
                .createValueExpression(fc.getELContext(), "#{delegatesInjector}", DelegatesInjector.class);
        final DelegatesInjector delegatesInjector = (DelegatesInjector) valueExpression.getValue(fc.getELContext());
        final Map<Class, ExceptionHandlerDelegate> delegatesMap = delegatesInjector.getDelegatesMap();
        try {
            if (delegateHandling(throwable, delegatesMap, fc)) {
                iterator.remove();
            } else {
                getWrapped().handle();
            }
        } catch (IOException e) {
            LOGGER.error("error while handling exception: " + throwable, e);
            getWrapped().handle();
        }
    }
}
 
开发者ID:noveogroup,项目名称:clap,代码行数:25,代码来源:DelegatingExceptionHandler.java

示例5: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
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");
            fc.renderResponse();
        } finally {
            i.remove();
        }
    }
    getWrapped().handle();
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:22,代码来源:GlobalExceptionHandler.java

示例6: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void handle() throws FacesException {
	FacesContext fc = FacesContext.getCurrentInstance();
	for ( Iterator<ExceptionQueuedEvent> i = this.getUnhandledExceptionQueuedEvents().iterator(); i.hasNext(); ) {
		ExceptionQueuedEvent event = i.next();
		ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
		Throwable t = context.getException();
		if ( fc.isProjectStage( ProjectStage.Development ) ) {
			t.printStackTrace();
		}
		do {
			if ( t instanceof AuthorizationException ) {
				this.handleAuthorizationException( fc, (AuthorizationException) t, i );
				return;
			}
			if ( t instanceof ViewExpiredException ) {
				this.handleViewExpiredException( fc, (ViewExpiredException) t, i );
				return;
			}
			t = t.getCause();
		} while ( t != null );
		this.handleGenericException( fc );
	}
}
 
开发者ID:PE-INTERNATIONAL,项目名称:soda4lca,代码行数:28,代码来源:FacesExceptionHandler.java

示例7: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    Iterable<ExceptionQueuedEvent> events = this.wrapped.getUnhandledExceptionQueuedEvents();
    for(Iterator<ExceptionQueuedEvent> it = events.iterator(); it.hasNext();) {
        ExceptionQueuedEvent event = it.next();
        ExceptionQueuedEventContext eqec = event.getContext();
        
        if(eqec.getException() instanceof ViewExpiredException) {
            FacesContext context = eqec.getContext();
            if(!context.isReleased()) {
                NavigationHandler navHandler = context.getApplication().getNavigationHandler();
 
                try {
                    navHandler.handleNavigation(context, null, "home?faces-redirect=true&expired=true");
                }
                finally {
                    it.remove();
                }
            }
            
        }
    }

    this.wrapped.handle();
}
 
开发者ID:websphere,项目名称:PrimefacesShowcase,代码行数:26,代码来源:ShowcaseExceptionHandler.java

示例8: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    Iterable<ExceptionQueuedEvent> events = this.wrapped.getUnhandledExceptionQueuedEvents();
    for(Iterator<ExceptionQueuedEvent> it = events.iterator(); it.hasNext();) {
        ExceptionQueuedEvent event = it.next();
        ExceptionQueuedEventContext eqec = event.getContext();
        System.out.println("eqec.getException()"+eqec.getException());
        if(eqec.getException() instanceof ViewExpiredException || eqec.getException() instanceof AbortProcessingException) {
            FacesContext context = eqec.getContext();
            NavigationHandler navHandler = context.getApplication().getNavigationHandler();
 
            try {
                navHandler.handleNavigation(context, null, "main.xhtml?faces-redirect=true&expired=true");
            }
            catch(Exception e){
                System.out.println("exp"+e);
            }
            finally {
                it.remove();
            }
        }
    }

    this.wrapped.handle();;
}
 
开发者ID:wbstr,项目名称:liferay-newsletter,代码行数:26,代码来源:WcsExceptionHandler.java

示例9: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    LOG.log(Level.INFO, "invoking custom ExceptionHandlder...");
    Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator();

    while (events.hasNext()) {
        ExceptionQueuedEvent event = events.next();
        ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
        Throwable t = context.getException();
        LOG.log(Level.INFO, "[email protected]" + t.getClass().getName());
        LOG.log(Level.INFO, "ExceptionHandlder began.");
        //t.printStackTrace();
        if (t instanceof ViewExpiredException) {
            try {
                handleViewExpiredException((ViewExpiredException) t);
            } finally {
                events.remove();
            }
        } else if (t instanceof TaskNotFoundException) {
            try {
                handleNotFoundException((Exception) t);
            } finally {
                events.remove();
            }
        } else {

            getWrapped().handle();
        }
        LOG.log(Level.INFO, "ExceptionHandlder end.");
    }

}
 
开发者ID:hantsy,项目名称:javaee8-jsf-sample,代码行数:33,代码来源:DefaultExceptionHandler.java

示例10: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    LOG.log(Level.INFO, "invoking custom ExceptionHandlder...");
    Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator();

    while (events.hasNext()) {
        ExceptionQueuedEvent event = events.next();
        ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
        Throwable t = context.getException();
        LOG.log(Level.INFO, "[email protected]" + t.getClass().getName());
        LOG.log(Level.INFO, "ExceptionHandlder began.");
        LOG.log(Level.INFO, "t instanceof [email protected]" + (t instanceof FacesException));
        //   log.log(Level.INFO, "t instanceof [email protected]" + (t instanceof FacesFileNotFoundException));
        t.printStackTrace();
        if (t instanceof ViewExpiredException) {
            try {
                handleViewExpiredException((ViewExpiredException) t);
            } finally {
                events.remove();
            }
        } else if (t instanceof FacesFileNotFoundException) {
            try {
                handleNotFoundException((Exception) t);
            } finally {
                events.remove();
            }
        } else {

            getWrapped().handle();
        }
        LOG.log(Level.INFO, "ExceptionHandlder end.");
    }

}
 
开发者ID:hantsy,项目名称:ee8-sandbox,代码行数:35,代码来源:DefaultExceptionHandler.java

示例11: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    Iterator<ExceptionQueuedEvent> it = getUnhandledExceptionQueuedEvents().iterator();
    while (it.hasNext()) {
        ExceptionQueuedEvent event = it.next();
        ExceptionQueuedEventContext c = (ExceptionQueuedEventContext) event.getSource();
        Throwable t = c.getException();

        HttpServletRequest req =
            (HttpServletRequest) c.getContext().getExternalContext().getRequest();
        HttpServletResponse res =
            (HttpServletResponse) c.getContext().getExternalContext().getResponse();
        handleException(req, res, t);
    }
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:16,代码来源:LinkBinderExceptionHandler.java

示例12: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) {
        ExceptionQueuedEvent event = i.next();
        ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
        Throwable t = context.getException();
        if (t instanceof ViewExpiredException) {
            ViewExpiredException vee = (ViewExpiredException) t;
            FacesContext fc = FacesContext.getCurrentInstance();
            Map<String, Object> requestMap = fc.getExternalContext().getRequestMap();
            NavigationHandler nav =
                    fc.getApplication().getNavigationHandler();
            try {
                // Push some useful stuff to the request scope for
                // use in the page
                requestMap.put("currentViewId", vee.getViewId());
 
                nav.handleNavigation(fc, null, "viewExpired");
                fc.renderResponse();
                RequestContext.getCurrentInstance().execute("PF('expiredSessionDialog').show();");
            } finally {
                i.remove();
            }
        }
    }
    // At this point, the queue will not contain any ViewExpiredEvents.
    // Therefore, let the parent handle them.
    getWrapped().handle();
 
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:31,代码来源:ViewExpiredExceptionExceptionHandler.java

示例13: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
    for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) {
        ExceptionQueuedEvent event = i.next();
        ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
        Throwable t = context.getException();
        if (t instanceof ViewExpiredException) {
            ViewExpiredException vee = (ViewExpiredException) t;
            LOG.log(Level.WARNING, "View Expired {0}", vee.getViewId());
            FacesContext fc = FacesContext.getCurrentInstance();
            NavigationHandler nav = fc.getApplication().getNavigationHandler();
            try {
                String navigation = vee.getViewId();
                if ("jobs/index.xhtml".equals(vee.getViewId())){
                    navigation += "?faces-redirect=true";
                }
                nav.handleNavigation(fc, null, navigation);
                fc.renderResponse();

            } finally {
                i.remove();
            }
        }
    }
    // At this point, the queue will not contain any ViewExpiredEvents.
    // Therefore, let the parent handle them.
    getWrapped().handle();

}
 
开发者ID:vodev,项目名称:vocloud,代码行数:30,代码来源:ViewExpiredExceptionHandler.java

示例14: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
	Iterator<ExceptionQueuedEvent> events = getUnhandledExceptionQueuedEvents().iterator();

	while (events.hasNext()) {
		ExceptionQueuedEvent event = events.next();
		ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();

		Throwable exception = context.getException();
		NegocioException negocioException = getNegocioException(exception);
		boolean handled = false;

		try {
			if (exception instanceof ViewExpiredException) {
				handled = true;
				redirect("/");
			} else if (negocioException != null) {
				handled = true;
				FacesUtil.addErrorMessage(negocioException.getMessage());
			} else {
				handled = true;
				log.error("Erro de sistema: " + exception.getMessage(), exception);
				redirect("/Erro.xhtml");
			}
		} finally {
			if (handled) {
				events.remove();
			}
		}
	}

	getWrapped().handle();

}
 
开发者ID:fabiohxcx,项目名称:PedidoVenda,代码行数:35,代码来源:JsfExceptionHandler.java

示例15: handle

import javax.faces.event.ExceptionQueuedEventContext; //导入依赖的package包/类
@Override
public void handle() throws FacesException {
	final Iterator<ExceptionQueuedEvent> iterator = getUnhandledExceptionQueuedEvents().iterator();
	
	while (iterator.hasNext()) {
		ExceptionQueuedEvent event = iterator.next();
		ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();

		Throwable throwable = context.getException();
		final FacesContext fc = FacesContext.getCurrentInstance();
		
		try {
			String message = throwable.getMessage();
			logger.error(message, throwable);
			WebHelper.setSessionAttribute(SessionKey.ERROR_MESSAGES.name(), Arrays.asList(message));
			
			ServletRequest request = (ServletRequest) fc.getExternalContext().getRequest();
			String url = UrlHelper.buildWebAppUrl(request, "error.xhtml");
			WebHelper.sendRedirect(url);
			fc.renderResponse();
		} finally {
			iterator.remove();
		}
	}
	
	getWrapped().handle();
}
 
开发者ID:aureliano,项目名称:verbum-domini,代码行数:28,代码来源:JsfExceptionHandler.java


注:本文中的javax.faces.event.ExceptionQueuedEventContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。