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


Java DefaultErrorView类代码示例

本文整理汇总了Java中org.apache.deltaspike.core.api.config.view.DefaultErrorView的典型用法代码示例。如果您正苦于以下问题:Java DefaultErrorView类的具体用法?Java DefaultErrorView怎么用?Java DefaultErrorView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: processAccessDeniedException

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
private void processAccessDeniedException(Throwable throwable)
{
    if (throwable instanceof ErrorViewAwareAccessDeniedException)
    {
        SecurityUtils.handleSecurityViolationWithoutNavigation((AccessDeniedException) throwable);
    }
    else
    {
        ErrorViewAwareAccessDeniedException securityException =
            new ErrorViewAwareAccessDeniedException(
                ((AccessDeniedException)throwable).getViolations(), DefaultErrorView.class);
        SecurityUtils.handleSecurityViolationWithoutNavigation(securityException);
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:15,代码来源:BridgeExceptionHandlerWrapper.java

示例2: getViewConfigDescriptor

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
@Override
public ViewConfigDescriptor getViewConfigDescriptor(Class<? extends ViewConfig> viewDefinitionClass)
{
    if (DefaultErrorView.class.equals(viewDefinitionClass))
    {
        return getDefaultErrorViewConfigDescriptor();
    }
    return this.viewDefinitionToViewDefinitionEntryMapping.get(viewDefinitionClass);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:10,代码来源:DefaultViewConfigResolver.java

示例3: tryToHandleSecurityViolation

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
private static void tryToHandleSecurityViolation(RuntimeException runtimeException,
                                                 boolean allowNavigation)
{
    ErrorViewAwareAccessDeniedException exception = extractException(runtimeException);

    if (exception == null)
    {
        throw runtimeException;
    }

    Class<? extends ViewConfig> errorView = null;

    Class<? extends ViewConfig> inlineErrorView = exception.getErrorView();

    if (inlineErrorView != null && !DefaultErrorView.class.getName().equals(inlineErrorView.getName()))
    {
        errorView = inlineErrorView;
    }

    if (errorView == null)
    {
        ViewConfigResolver viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);
        ViewConfigDescriptor errorPageDescriptor = viewConfigResolver.getDefaultErrorViewConfigDescriptor();

        if (errorPageDescriptor != null)
        {
            errorView = errorPageDescriptor.getConfigClass();
        }
    }

    if (errorView == null && allowNavigation)
    {
        throw exception;
    }

    processApplicationSecurityException(exception, errorView, allowNavigation);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:38,代码来源:SecurityUtils.java

示例4: testDefaultErrorViewInViewConfig

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
@Test
public void testDefaultErrorViewInViewConfig()
{
    this.viewConfigExtension.addPageDefinition(Pages.Index.class);

    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();

    Assert.assertNotNull(viewConfigResolver.getDefaultErrorViewConfigDescriptor());
    Assert.assertEquals(Pages.Index.class, viewConfigResolver.getDefaultErrorViewConfigDescriptor().getConfigClass());
    Assert.assertEquals(Pages.Index.class, viewConfigResolver.getViewConfigDescriptor(DefaultErrorView.class).getConfigClass());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:12,代码来源:ViewConfigTest.java

示例5: handle

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
@Override
public void handle() throws FacesException
{
    lazyInit();
    Iterator<ExceptionQueuedEvent> exceptionQueuedEventIterator = getUnhandledExceptionQueuedEvents().iterator();

    while (exceptionQueuedEventIterator.hasNext())
    {
        ExceptionQueuedEventContext exceptionQueuedEventContext =
                (ExceptionQueuedEventContext) exceptionQueuedEventIterator.next().getSource();

        @SuppressWarnings({ "ThrowableResultOfMethodCallIgnored" })
        Throwable throwable = exceptionQueuedEventContext.getException();

        String viewId = null;

        if (!isExceptionToHandle(throwable))
        {
            continue;
        }

        FacesContext facesContext = exceptionQueuedEventContext.getContext();
        Flash flash = facesContext.getExternalContext().getFlash();

        if (throwable instanceof ViewExpiredException)
        {
            viewId = ((ViewExpiredException) throwable).getViewId();
        }
        else if (throwable instanceof ContextNotActiveException)
        {
            //the error page uses a cdi scope which isn't active as well
            //(it's recorded below - see flash.put(throwable.getClass().getName(), throwable);)
            if (flash.containsKey(ContextNotActiveException.class.getName()))
            {
                //TODO show it in case of project-stage development
                break;
            }

            if (facesContext.getViewRoot() != null)
            {
                viewId = facesContext.getViewRoot().getViewId();
            }
            else
            {
                viewId = BeanProvider.getContextualReference(ViewConfigResolver.class)
                        //has to return a value otherwise this handler wouldn't be active
                        .getDefaultErrorViewConfigDescriptor().getViewId();
            }
        }

        if (viewId != null)
        {
            UIViewRoot uiViewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);

            if (uiViewRoot == null)
            {
                continue;
            }

            if (facesContext.isProjectStage(javax.faces.application.ProjectStage.Development) ||
                    ProjectStageProducer.getInstance().getProjectStage() == ProjectStage.Development ||
                    ProjectStageProducer.getInstance().getProjectStage() instanceof TestStage)
            {
                throwable.printStackTrace();
            }

            facesContext.setViewRoot(uiViewRoot);
            exceptionQueuedEventIterator.remove();

            //record the current exception -> to check it at the next call or to use it on the error-page
            flash.put(throwable.getClass().getName(), throwable);
            flash.keep(throwable.getClass().getName());

            this.viewNavigationHandler.navigateTo(DefaultErrorView.class);

            break;
        }
    }

    this.wrapped.handle();
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:82,代码来源:DefaultErrorViewAwareExceptionHandlerWrapper.java

示例6: handleNavigation

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
@Override
public void handleNavigation(FacesContext facesContext, String fromAction, String outcome)
{
    lazyInit();
    if (outcome != null && outcome.contains("."))
    {
        String originalOutcome = outcome;

        if (!this.otherOutcomes.contains(outcome))
        {
            //it isn't possible to support interfaces due to cdi restrictions
            if (outcome.startsWith("class "))
            {
                outcome = outcome.substring(6);
            }
            ViewConfigDescriptor entry = this.viewConfigs.get(outcome);

            if (entry == null)
            {
                if (DefaultErrorView.class.getName().equals(originalOutcome))
                {
                    entry = this.viewConfigResolver.getDefaultErrorViewConfigDescriptor();
                }
            }

            boolean allowCaching = true;
            if (entry == null)
            {
                Class<?> loadedClass = ClassUtils.tryToLoadClassForName(outcome);

                if (loadedClass == null)
                {
                    this.otherOutcomes.add(originalOutcome);
                }
                else if (ViewConfig.class.isAssignableFrom(loadedClass))
                {
                    //a sub-classed page-config for annotating it with different view params
                    if (loadedClass.getAnnotation(View.class) == null &&
                            loadedClass.getSuperclass().getAnnotation(View.class) != null)
                    {
                        allowCaching = false;
                        addConfiguredViewParameters(loadedClass);

                        loadedClass = loadedClass.getSuperclass();
                    }
                    entry = this.viewConfigResolver
                            .getViewConfigDescriptor((Class<? extends ViewConfig>) loadedClass);
                }
            }

            if (entry != null)
            {
                //in case of false it has been added already
                if (allowCaching)
                {
                    this.viewConfigs.put(outcome, entry);
                    addConfiguredViewParameters(entry.getConfigClass());
                }

                String oldViewId = null;

                if (facesContext.getViewRoot() != null)
                {
                    oldViewId = facesContext.getViewRoot().getViewId();
                }

                PreViewConfigNavigateEvent navigateEvent = firePreViewConfigNavigateEvent(oldViewId, entry);

                entry = tryToUpdateEntry(entry, navigateEvent);

                if (entry != null)
                {
                    outcome = convertEntryToOutcome(facesContext.getExternalContext(), entry);
                }
            }
        }
    }

    this.navigationHandler.handleNavigation(facesContext, fromAction, outcome);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:81,代码来源:ViewConfigAwareNavigationHandler.java

示例7: isInternal

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
private boolean isInternal(Class configClass)
{
    return ViewConfig.class.equals(configClass) ||
            DefaultErrorView.class.equals(configClass) ||
            ViewRef.Manual.class.equals(configClass);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:7,代码来源:ViewConfigExtension.java

示例8: anyMethod

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
public void anyMethod()
{
    //navigates to the view which is configured as default error-view
    //(in this example via a redirect, because it's configured for PageConfigForRedirect)
    this.viewNavigationHandler.navigateTo(DefaultErrorView.class);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:7,代码来源:PageBean006.java

示例9: actionWithError

import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
public Class<? extends ViewConfig> actionWithError()
{
    return DefaultErrorView.class;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:5,代码来源:PageBean002.java


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