本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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());
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例9: actionWithError
import org.apache.deltaspike.core.api.config.view.DefaultErrorView; //导入依赖的package包/类
public Class<? extends ViewConfig> actionWithError()
{
return DefaultErrorView.class;
}