use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver in project deltaspike by apache.
the class ViewConfigPathTest method testNamesWizard3.
@Test
public void testNamesWizard3() {
this.viewConfigExtension.addPageDefinition(Pages.Wizard3.Step1.class);
this.viewConfigExtension.addPageDefinition(Pages.Wizard3.Step2.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor;
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard3.Step1.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/wizard3/step1.xhtml", viewConfigDescriptor.getViewId());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard3.Step2.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/step2.xhtml", viewConfigDescriptor.getViewId());
}
use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver in project deltaspike by apache.
the class ViewConfigPathTest method testNamesWizard8.
@Test
public void testNamesWizard8() {
this.viewConfigExtension.addPageDefinition(Pages.Wizard8.Step1.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor;
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard8.Step1.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/pages/w8/step1.xhtml", viewConfigDescriptor.getViewId());
}
use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver in project deltaspike by apache.
the class ViewConfigResolverProducer method createViewConfigResolver.
@Produces
@ApplicationScoped
public ViewConfigResolver createViewConfigResolver() {
if (!viewConfigExtension.isActivated()) {
return createEmptyDefaultViewConfigResolver();
}
if (// esp. for easier unit-tests
!viewConfigExtension.isTransformed()) {
viewConfigExtension.transformMetaDataTree();
}
ViewConfigResolver viewConfigResolver = viewConfigExtension.getViewConfigResolver();
if (viewConfigResolver == null) {
LOG.warning("It wasn't possible to create a ViewConfigResolver");
viewConfigResolver = createEmptyDefaultViewConfigResolver();
}
return viewConfigResolver;
}
use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver in project deltaspike by apache.
the class ViewConfigPathValidator method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent sce) {
if (ClassDeactivationUtils.isActivated(getClass())) {
ViewConfigResolver viewConfigResolver;
try {
viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Container issue detected -> can't validate view-configs. " + "This exception is usually the effect (but not the reason) of a failed startup. " + "You can deactivate " + getClass().getName() + " via a custom " + ClassDeactivator.class.getName() + " to verify it.", e);
return;
}
List<String> supportedExtensions = new ArrayList<String>();
supportedExtensions.add(View.Extension.XHTML);
supportedExtensions.add(View.Extension.JSP);
validateViewConfigPaths(sce, viewConfigResolver, supportedExtensions);
}
}
use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver in project deltaspike by apache.
the class SecurityUtils method tryToHandleSecurityViolation.
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);
}
Aggregations