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


Java ViewConfigResolver类代码示例

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


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

示例1: createViewConfigResolver

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
@Produces
@ApplicationScoped
public ViewConfigResolver createViewConfigResolver()
{
    if (!viewConfigExtension.isActivated())
    {
        return createEmptyDefaultViewConfigResolver();
    }

    if (!viewConfigExtension.isTransformed()) //esp. for easier unit-tests
    {
        viewConfigExtension.transformMetaDataTree();
    }
    ViewConfigResolver viewConfigResolver = viewConfigExtension.getViewConfigResolver();

    if (viewConfigResolver == null)
    {
        LOG.warning("It wasn't possible to create a ViewConfigResolver");
        viewConfigResolver = createEmptyDefaultViewConfigResolver();
    }

    return viewConfigResolver;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:24,代码来源:ViewConfigResolverProducer.java

示例2: contextInitialized

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:27,代码来源:ViewConfigPathValidator.java

示例3: testValidViewConfig

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

    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();

    List<String> supportedExtensions = new ArrayList<String>();
    supportedExtensions.add(View.Extension.XHTML);

    try
    {
        new MockedViewConfigPathValidator(true).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);
    }
    catch (Exception e)
    {
        Assert.fail("valid view-config was reported as invalid");
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:20,代码来源:ViewConfigPathValidatorTest.java

示例4: testMissingPathButUnsupportedExtension

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

    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();

    List<String> supportedExtensions = new ArrayList<String>();
    supportedExtensions.add(View.Extension.JSF);

    try
    {
        new MockedViewConfigPathValidator(false).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);
    }
    catch (Exception e)
    {
        Assert.fail("unsupported extension wasn't ignored");
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:20,代码来源:ViewConfigPathValidatorTest.java

示例5: testSimpleViewConfigWithExplicitPageMetaData

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
@Test
public void testSimpleViewConfigWithExplicitPageMetaData()
{
    this.viewConfigExtension.addPageDefinition(SimplePageConfig002.class);

    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
    ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig002.class);

    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/simplePageConfig002.xhtml", viewConfigDescriptor.getViewId());
    Assert.assertEquals(SimplePageConfig002.class, viewConfigDescriptor.getConfigClass());
    Assert.assertNotNull(viewConfigDescriptor.getMetaData());

    Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
    Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:17,代码来源:ViewConfigTest.java

示例6: testSimpleViewConfigWithOptionalPageMetaData

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
@Test
public void testSimpleViewConfigWithOptionalPageMetaData()
{
    this.viewConfigExtension.addPageDefinition(SimplePageConfig001.class);

    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
    ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig001.class);

    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/simplePageConfig001.xhtml", viewConfigDescriptor.getViewId());
    Assert.assertEquals(SimplePageConfig001.class, viewConfigDescriptor.getConfigClass());
    Assert.assertNotNull(viewConfigDescriptor.getMetaData());

    //@View gets added autom. if it isn't provided in-/directly
    Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
    Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:18,代码来源:ViewConfigTest.java

示例7: testNamesWizard3

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
@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());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:20,代码来源:ViewConfigPathTest.java

示例8: testNamesWizard4

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
@Test
public void testNamesWizard4()
{
    this.viewConfigExtension.addPageDefinition(Pages.Wizard4.Step1.class);
    this.viewConfigExtension.addPageDefinition(Pages.Wizard4.Step2.class);

    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();

    ViewConfigDescriptor viewConfigDescriptor;


    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard4.Step1.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/pages/wizard4/step1.xhtml", viewConfigDescriptor.getViewId());

    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard4.Step2.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/step2.xhtml", viewConfigDescriptor.getViewId());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:20,代码来源:ViewConfigPathTest.java

示例9: testSimpleViewConfigWithViewControllerCallback

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
@Test
public void testSimpleViewConfigWithViewControllerCallback()
{
    this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);
    this.viewConfigExtension.addIndirectlyInheritedMetaData(PageBean003.class);

    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
    ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig.class);

    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class));
    Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class));
    Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class));
    Assert.assertNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PostRenderView.class));

    Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class).getCallbackMethods().keySet().iterator().next());
    Assert.assertEquals("callbackMethod1", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());

    Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class).getCallbackMethods().keySet().iterator().next());
    Assert.assertEquals("callbackMethod1", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());

    Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class).getCallbackMethods().keySet().iterator().next());
    Assert.assertEquals("callbackMethod2", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:25,代码来源:ViewConfigTest.java

示例10: lazyInit

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
private synchronized void lazyInit()
{
    this.securityModuleActivated =
        BeanProvider.getContextualReference(EditableAccessDecisionVoterContext.class, true) != null;

    this.viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);

    if (!this.securityModuleActivated)
    {
        Logger.getLogger(getClass().getName()) //it's the only case for which a logger is needed in this class
                .info("security-module-impl isn't used -> " + getClass().getName() +
                        "#checkSecuredView gets deactivated");
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:15,代码来源:DeltaSpikePhaseListener.java

示例11: processAction

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
@Override
public void processAction(ActionEvent actionEvent)
{
    if (this.activated)
    {
        ViewConfigDescriptor viewConfigDescriptor = BeanProvider.getContextualReference(ViewConfigResolver.class)
                .getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId());

        ViewControllerUtils.executeViewControllerCallback(viewConfigDescriptor, PreViewAction.class);
    }

    this.wrapped.processAction(actionEvent);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:14,代码来源:ViewControllerActionListener.java

示例12: init

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
private synchronized void init()
{
    if (this.beanManager == null)
    {
        this.beanManager = BeanManagerProvider.getInstance().getBeanManager();
        this.navigationParameterContext =
                BeanProvider.getContextualReference(NavigationParameterContext.class);
        this.viewConfigResolver =
                BeanProvider.getContextualReference(ViewConfigResolver.class);
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:12,代码来源:ViewConfigAwareNavigationHandler.java

示例13: createCustomViewConfigResolver

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的package包/类
private ViewConfigResolver createCustomViewConfigResolver(ViewConfigRoot viewConfigRoot,
                                                          ConfigNodeConverter configNodeConverter,
                                                          ViewConfigInheritanceStrategy inheritanceStrategy,
                                                          List<ConfigDescriptorValidator> validators)
{
    Class<? extends ViewConfigResolver> viewConfigResolverClass = viewConfigRoot.viewConfigResolver();
    if (!ViewConfigResolver.class.equals(viewConfigResolverClass))
    {
        try
        {
            Constructor<? extends ViewConfigResolver> viewConfigResolverConstructor = viewConfigResolverClass
                    .getConstructor(new Class[]{
                        ViewConfigNode.class,
                        ConfigNodeConverter.class,
                        ViewConfigInheritanceStrategy.class,
                        List.class});

            return viewConfigResolverConstructor
                    .newInstance(this.rootViewConfigNode, configNodeConverter, inheritanceStrategy, validators);
        }
        catch (Exception e)
        {
            throw ExceptionUtils.throwAsRuntimeException(e);
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:28,代码来源:ViewConfigExtension.java

示例14: tryToHandleSecurityViolation

import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver; //导入依赖的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

示例15: testMissingPath

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

    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();

    List<String> supportedExtensions = new ArrayList<String>();
    supportedExtensions.add(View.Extension.XHTML);
    new MockedViewConfigPathValidator(false).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:12,代码来源:ViewConfigPathValidatorTest.java


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