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


Java FacesContext.release方法代码示例

本文整理汇总了Java中javax.faces.context.FacesContext.release方法的典型用法代码示例。如果您正苦于以下问题:Java FacesContext.release方法的具体用法?Java FacesContext.release怎么用?Java FacesContext.release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.context.FacesContext的用法示例。


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

示例1: setUp

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
  super.setUp();
  FacesContext oldFacesContext = facesContext;
  UIViewRoot oldViewRoot = oldFacesContext.getViewRoot();
  oldFacesContext.release();
  facesContext = new MockFacesContext12(externalContext,
                                        lifecycle,
                                        application);
  facesContext.setViewRoot(oldViewRoot);
  facesContext.setApplication(application);

  facesContext.getViewRoot().setRenderKitId("org.apache.myfaces.trinidad.core"); 
  RenderKitFactory renderKitFactory = (RenderKitFactory)
  FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
  Mock mockRenderKitty = mock(RenderKit.class);
  RenderKit renderKit = (RenderKit) mockRenderKitty.proxy();
  _mockRenderKit = new MockRenderKitWrapper(mockRenderKitty, renderKit);
  renderKitFactory.addRenderKit("org.apache.myfaces.trinidad.core", renderKit);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:FacesTestCase.java

示例2: setUp

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
  super.setUp();
  // Set up a JSF 1.2 FacesContext
  FacesContext oldFacesContext = facesContext;
  UIViewRoot oldViewRoot = oldFacesContext.getViewRoot();
  oldFacesContext.release();
  facesContext = new MockFacesContext12(externalContext,
                                        lifecycle,
                                        application);
  facesContext.setViewRoot(oldViewRoot);
  facesContext.setApplication(application);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:15,代码来源:AbstractBaseTestCase.java

示例3: doFilter

import javax.faces.context.FacesContext; //导入方法依赖的package包/类
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
    FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
    LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
    Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

    // Either set a private member
    //   servletContext = filterConfig.getServletContext();
    // in your filter init() method or set it here like this:
    //   ServletContext servletContext =
    //     ((HttpServletRequest) request).getSession().getServletContext();
    // Note that the above line would fail if you are using any other
    // protocol than http

    // Doesn't set this instance as the current instance of
    // FacesContext.getCurrentInstance
    FacesContext facesContext = contextFactory.getFacesContext(servletContext, request, response, lifecycle);

    // Set using our inner class
    InnerFacesContext.setFacesContextAsCurrentInstance(facesContext);

    try
    {
        // call the filter chain
        chain.doFilter(request, response);
    }
    finally
    {
        // Clean up after ourselves as FacesContext is a ThreadLocal object
        try
        {
            facesContext.release();
        }
        catch (IllegalStateException ex)
        {
            // Perhaps the FacesContext has already been released?
            log.warn("Double release of faces context?", ex);
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:FacesExtensionFilter.java


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