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


Java FactoryFinder.getFactory方法代码示例

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


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

示例1: _getResponseStateManager

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
static private ResponseStateManager _getResponseStateManager(
  FacesContext context,
  String       renderKitId)
{
  RenderKitFactory factory = (RenderKitFactory)
    FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
  RenderKit kit = factory.getRenderKit(context, renderKitId);
  return kit.getResponseStateManager();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:10,代码来源:StateManagerImpl.java

示例2: handleError

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
/**
 * Handle a server-side error by reporting it back to the client.
 */
public static void handleError(ExternalContext ec, 
                               Throwable t) throws IOException
{
  String error = _getErrorString();
  _LOG.severe(error, t);

  ServletResponse response = (ServletResponse)ec.getResponse();
  PrintWriter writer = response.getWriter();
  XmlResponseWriter rw = new XmlResponseWriter(writer, "UTF-8");
  rw.startDocument();
  rw.startElement("partial-response", null);
  rw.startElement("error", null);
  rw.startElement("error-name", null);
  rw.writeText(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null);
  rw.endElement("error-name");

  String errorMessage = _getErrorMessage(error);

  // Default exception message contains the type of the exception.
  // Do not send this info to client in Production mode
  ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
  Application application = factory.getApplication();
  if (application.getProjectStage() != ProjectStage.Production)
  {
    errorMessage = _getExceptionString(t) + errorMessage;
  }

  rw.startElement("error-message", null);
  rw.writeText(errorMessage, null);
  rw.endElement("error-message");

  rw.endElement("error");
  rw.endElement("partial-response");
  rw.endDocument();
  rw.close();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:40,代码来源:XmlHttpConfigurator.java

示例3: _createValueExpressionFromApplication

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
private static ValueExpression _createValueExpressionFromApplication(
  String expression,
  Class<?> expectedType)
{
  ApplicationFactory factory = (ApplicationFactory)
    FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
  if (factory != null)
  {
    Application application = factory.getApplication();
    if (application != null)
    {
      ELContext elContext = _getELContext(application);

      ExpressionFactory expressionFactory = application.getExpressionFactory();
      if (expressionFactory != null)
      {
        return expressionFactory.createValueExpression(elContext, expression, expectedType);
      }
    }
  }

  return null;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:24,代码来源:LazyValueExpression.java

示例4: getRenderKit

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
static public RenderKit getRenderKit(FacesContext context)
{
  RenderKitFactory factory = (RenderKitFactory)
    FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);

  factory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT, new BasicHtmlRenderKit());

  String renderKitId = null;
  if (context.getViewRoot() != null)
    renderKitId = context.getViewRoot().getRenderKitId();
  if (renderKitId == null)
    renderKitId = "org.apache.myfaces.trinidad.core";

  RenderKit renderKit = factory.getRenderKit(context,renderKitId);
  if (renderKit == null)
    throw new IllegalStateException("Could not create renderKit " + renderKitId);

  return renderKit;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:20,代码来源:RenderKitBootstrap.java

示例5: getFacesContext

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
/**
 * @param request
 * @param response
 * @return
 */
private FacesContext getFacesContext(final ServletRequest request, final ServletResponse response) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    if (facesContext != null) {
        return facesContext;
    }

    FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder
            .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
    LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
            .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
    Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

    ServletContext servletContext = ((HttpServletRequest) request).getSession().getServletContext();
    facesContext = contextFactory.getFacesContext(servletContext, request, response, lifecycle);

    return facesContext;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:PrettyUrlFilter.java

示例6: setUp

import javax.faces.FactoryFinder; //导入方法依赖的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

示例7: getJSFInfo

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
/**
 * gets JSF information like JSF version and Faces context.
 *
 * @return the JSF info
 */
public static Map<String, Object> getJSFInfo() {
	final LinkedHashMap<String, Object> details = new LinkedHashMap<String, Object>();
	final FacesContext context = FacesContext.getCurrentInstance();
	final Application application = context.getApplication();
	final ViewHandler viewHandler = application.getViewHandler();
	final ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(context, context.getViewRoot().getViewId());
	final LifecycleFactory LifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);

	details.put("JSF-Version", FacesContext.class.getPackage().getImplementationVersion());
	details.put("JSF-Version-Package", FacesContext.class.getPackage().getName());
	details.put("FacesContext", context.getClass());
	details.put("Application", application.getClass());
	details.put("ViewHandler", viewHandler.getClass());
	details.put("ViewDeclarationLanguage", vdl.getClass());
	details.put("LifecycleFactory", LifecycleFactory.getClass());

	return details;
}
 
开发者ID:kiswanij,项目名称:jk-faces,代码行数:24,代码来源:JKJsfUtil.java

示例8: setupResponseWriter

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
/** setup the JSF response writer. */
private ResponseWriter setupResponseWriter(final String mimetype,
                                           final HttpServletResponse response, 
                                           final FacesContext facesContext)
   throws IOException
{
   final OutputStream os = response.getOutputStream();
   final UIViewRoot viewRoot = facesContext.getViewRoot();
   final RenderKitFactory renderFactory = (RenderKitFactory)
      FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
   final RenderKit renderKit = 
      renderFactory.getRenderKit(facesContext, viewRoot.getRenderKitId());
   final ResponseWriter writer = 
      renderKit.createResponseWriter(new OutputStreamWriter(os, "UTF-8"), 
                                     mimetype, 
                                     "UTF-8");
   facesContext.setResponseWriter(writer);
   // must be text/xml otherwise IE doesn't parse the response properly into responseXML
   response.setContentType(mimetype);
   return writer;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:InvokeCommand.java

示例9: getFacesContextImpl

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
/**
 * Return a valid FacesContext for the specific context, request and response.
 * The FacesContext can be constructor for Servlet and Portlet use.
 * 
 * @param context       ServletContext or PortletContext
 * @param request       ServletRequest or PortletRequest
 * @param response      ServletReponse or PortletResponse
 * 
 * @return FacesContext
 */
private static FacesContext getFacesContextImpl(Object request, Object response, Object context, String viewRoot)
{
   FacesContextFactory contextFactory = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
   LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
   Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

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

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

   // set a new viewRoot, otherwise context.getViewRoot returns null
   if (viewRoot == null)
   {
      viewRoot = FacesHelper.BROWSE_VIEW_ID;
   }
   
   UIViewRoot view = facesContext.getApplication().getViewHandler().createView(facesContext, viewRoot);
   facesContext.setViewRoot(view);

   return facesContext;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:34,代码来源:FacesHelper.java

示例10: createFacesContext

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
public static FacesContext createFacesContext(AbstractXspTest test,
        HttpServletRequest request) throws Exception {
    FacesController controller = (FacesController) test.getTestLocalVars().get("controller");
    if( null == controller ){
        bootstrap(test);
        controller = (FacesController) test.getTestLocalVars().get("controller");
    }
    LocalServletContext servletContext = (LocalServletContext) test.getTestLocalVars().get("servletContext");
    
    HttpServletResponse response = new LocalHttpServletResponse(servletContext, null);
    FacesContextFactory factory1 = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
    
    FacesContext context = factory1.getFacesContext(servletContext, request, response, controller.getLifecycle());
    String sessionId = request.getSession().getId();
    SessionUtil.setSessionId(context, sessionId);
    
    test.getTestLocalVars().put("facesContext", context);
    return context;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:20,代码来源:TestProject.java

示例11: jsfDispatchPage

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
/**
 * Jsf dispatch page.
 * 
 * @param fctx the faces context
 * @param page the pge
 */
private void jsfDispatchPage(FacesContext fctx, String page) {
  LifecycleFactory lf = (LifecycleFactory) FactoryFinder
      .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
  Lifecycle lifecycle = lf.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
  ViewHandler vh = fctx.getApplication().getViewHandler();
  fctx.getViewRoot().setRenderKitId(vh.calculateRenderKitId(fctx));
  fctx.setViewRoot(vh.createView(fctx, page));
  
  // view rendering
  try {
    lifecycle.render(fctx);
  } catch (Exception e) {
    LOG.log(Level.INFO, "Error while rendering page. Attempting again" + page,
        e);
    lifecycle.render(fctx);
  } finally {
    fctx.release();
  }
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:26,代码来源:HtmlAdvancedWriter.java

示例12: getFacesContext

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
/**
 * Gets the faces context.
 *
 * @param request the request
 * @param response the response
 * @return the faces context
 */
protected FacesContext getFacesContext(HttpServletRequest request,
		HttpServletResponse response) {
	FacesContext facesContext = FacesContext.getCurrentInstance();
	if (facesContext == null) {

		FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder
				.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
		LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
				.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
		Lifecycle lifecycle = lifecycleFactory
				.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

		facesContext = contextFactory.getFacesContext(request.getSession()
				.getServletContext(), request, response, lifecycle);

		// set a new viewRoot, otherwise context.getViewRoot returns null
		UIViewRoot view = facesContext.getApplication().getViewHandler()
				.createView(facesContext, "");
		facesContext.setViewRoot(view);
	}
	return facesContext;
}
 
开发者ID:mattiamascia,项目名称:atask,代码行数:30,代码来源:DownloadCtr.java

示例13: getFacesContext

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
public FacesContext getFacesContext(ServletRequest request, ServletResponse response) {
	FacesContext facesContext = FacesContext.getCurrentInstance();
	if (facesContext != null) {
		return facesContext;
	}
	FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
	LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
	Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
	ServletContext servletContext = ((HttpServletRequest) request).getSession().getServletContext();
	facesContext = contextFactory.getFacesContext(servletContext, request, response, lifecycle);
	InnerFacesContext.setFacesContextAsCurrentInstance(facesContext);
	if (null == facesContext.getViewRoot()) {
		facesContext.setViewRoot(new UIViewRoot());
	}
	return facesContext;
}
 
开发者ID:wangyeee,项目名称:IBE-Secure-Message,代码行数:17,代码来源:SessionFilter.java

示例14: getFacesContext

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
public FacesContext getFacesContext(final ServletRequest request,
		final ServletResponse response, HttpSession ses) {
	FacesContext facesContext = FacesContext.getCurrentInstance();
	if (facesContext != null) {
		return facesContext;
	}

	FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder
			.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
	LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
			.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
	Lifecycle lifecycle = lifecycleFactory
			.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

	ServletContext servletContext = ses.getServletContext();
	facesContext = contextFactory.getFacesContext(servletContext, request,
			response, lifecycle);
	InnerFacesContext.setFacesContextAsCurrentInstance(facesContext);
	if (null == facesContext.getViewRoot()) {
		UIViewRoot u = new UIViewRoot();
		u.setViewId("irgendwas");
		facesContext.setViewRoot(u);
	}

	return facesContext;
}
 
开发者ID:play4science,项目名称:gwap,代码行数:27,代码来源:FacesContextBuilder.java

示例15: getPartialViewContext

import javax.faces.FactoryFinder; //导入方法依赖的package包/类
@Override
public PartialViewContext getPartialViewContext()
{
  if (_partialViewContext == null)
  {
    PartialViewContextFactory f = (PartialViewContextFactory)
                    FactoryFinder.getFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY);
    _partialViewContext = f.getPartialViewContext(this);
  }

  return _partialViewContext;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:13,代码来源:PseudoFacesContext.java


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