本文整理汇总了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);
}
示例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);
}
示例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);
}
}
}