當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。