• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ApplicationFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.faces.application.ApplicationFactory的典型用法代码示例。如果您正苦于以下问题:Java ApplicationFactory类的具体用法?Java ApplicationFactory怎么用?Java ApplicationFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ApplicationFactory类属于javax.faces.application包,在下文中一共展示了ApplicationFactory类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleError

import javax.faces.application.ApplicationFactory; //导入依赖的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


示例2: _createValueExpressionFromApplication

import javax.faces.application.ApplicationFactory; //导入依赖的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


示例3: getApplication

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
@Override
public Application getApplication()
{
  if (_application == null)
  {
      _application = ((ApplicationFactory) FactoryFinder.getFactory(
              FactoryFinder.APPLICATION_FACTORY)).getApplication();
  }

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


示例4: _getELResolver

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
static private ELResolver _getELResolver(FacesContext context)
{
  // First try the FacesContext, which is a faster way to
  // get the ELResolver (and the 99.9% scenario)
  if (context != null)
    return context.getApplication().getELResolver();

  // If that fails, then we're likely outside of the JSF lifecycle.
  // Look to the ApplicationFactory.
  ApplicationFactory factory = (ApplicationFactory)
    FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
  return factory.getApplication().getELResolver();

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:15,代码来源:SortableModel.java


示例5: contextInitialized

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
    javax.faces.application.Application app = factory.getApplication();
    app.addELResolver(new SpringBeanFacesELResolver());
}
 
开发者ID:UrsZeidler,项目名称:checksumDatabase,代码行数:9,代码来源:Application.java


示例6: lookupTemplateBean

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
/**
 * Helper method to look up template backing bean.
 * @param context the faces context
 * @return the backing bean
 * @throws FacesException
 */
protected TemplateBean lookupTemplateBean(FacesContext context) throws
    FacesException
{
  TemplateBean templateBean;
  //FacesContext facesContext = FacesContext.getCurrentInstance();
  ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(
      FactoryFinder.APPLICATION_FACTORY);
  Application application = factory.getApplication();
  templateBean = (TemplateBean)
      application.getVariableResolver().resolveVariable(context, "template");
  return templateBean;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:TemplateBaseListener.java


示例7: lookupBean

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
/**
 * Helper method to look up backing bean.
 * Don't forget to cast!
 *   e.g. (TemplateBean) ContextUtil.lookupBean("template")
 * @param context the faces context
 * @return the backing bean
 * @throws FacesException
 */
public static Serializable lookupBean(String beanName)
{
  FacesContext facesContext = FacesContext.getCurrentInstance();
  ApplicationFactory factory = (ApplicationFactory) FactoryFinder.
                               getFactory(
                               FactoryFinder.APPLICATION_FACTORY);
  Application application = factory.getApplication();
  Serializable bean = (Serializable)
                      application.getVariableResolver().resolveVariable(
                      facesContext, beanName);
  return bean;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:ContextUtil.java


示例8: lookupBeanFromExternalServlet

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
/**
 * Helper method to look up backing bean, when OUTSIDE faces in a servlet.
 * Don't forget to cast!
 *   e.g. (TemplateBean) ContextUtil.lookupBean("template")
 *
 * @param beanName
 * @param request servlet request
 * @param response servlet response
 * @return the backing bean
 */
public static Serializable lookupBeanFromExternalServlet(String beanName,
  HttpServletRequest request, HttpServletResponse response)
{
  // prepare lifecycle
  LifecycleFactory lFactory = (LifecycleFactory)
      FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
  Lifecycle lifecycle =
      lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

  FacesContextFactory fcFactory = (FacesContextFactory)
      FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);

  // in the integrated environment, we can't get the ServletContext from the
  // HttpSession of the request - because the HttpSession is webcontainer-wide,
  // its not tied to a particular servlet.
  ServletContext servletContext = M_servletContext;
   if (servletContext == null)
  {
  	servletContext = request.getSession().getServletContext();
  }

  FacesContext facesContext =
      fcFactory.getFacesContext(servletContext, request, response, lifecycle);

  ApplicationFactory factory = (ApplicationFactory) FactoryFinder.
                               getFactory(
                               FactoryFinder.APPLICATION_FACTORY);
  Application application = factory.getApplication();
  Serializable bean = (Serializable)
                      application.getVariableResolver().resolveVariable(
                      facesContext, beanName);
  return bean;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:44,代码来源:ContextUtil.java


示例9: getValueBinding

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
public ValueBinding getValueBinding(String valueRef) {
	ApplicationFactory af =
		(ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
	Application a = af.getApplication();

	return (a.createValueBinding(valueRef));
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:8,代码来源:CustomSelectOneRadioTag.java


示例10: lookupBeanFromExternalServlet

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
/**
 * Helper method to look up backing bean, when OUTSIDE faces in a servlet.
 * Don't forget to cast! e.g. (TemplateBean)
 * ContextUtil.lookupBean("template")
 * 
 * @param beanName
 * @param request
 *            servlet request
 * @param response
 *            servlet response
 * @return the backing bean
 */
public Serializable lookupBeanFromExternalServlet(String beanName,
		HttpServletRequest request, HttpServletResponse response) {
	// prepare lifecycle
	LifecycleFactory lFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
	Lifecycle lifecycle = lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

	FacesContextFactory fcFactory = (FacesContextFactory) FactoryFinder
			.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);

	// in the integrated environment, we can't get the ServletContext from
	// the
	// HttpSession of the request - because the HttpSession is
	// webcontainer-wide,
	// its not tied to a particular servlet.

	if (this.servletContext == null) {
		servletContext = request.getSession().getServletContext();
	}

	FacesContext facesContext = fcFactory.getFacesContext(servletContext,
			request, response, lifecycle);

	ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
	Application application = factory.getApplication();
	Serializable bean = (Serializable) application.getVariableResolver().resolveVariable(facesContext, beanName);
	return bean;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:40,代码来源:SignupServlet.java


示例11: EventDrivenUpdatesContext

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
/**
 * Initializes an {@link EventDrivenUpdatesContext}.
 * 
 * @param config a configuration
 */
public EventDrivenUpdatesContext(EventDrivenUpdatesConfig config) {
    this.config = config;

    final ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
    if (applicationFactory != null) {
        applicationFactory.getApplication().subscribeToEvent(
                PostAddToViewEvent.class, config.getListener());
    }
}
 
开发者ID:encoway,项目名称:edu,代码行数:15,代码来源:EventDrivenUpdatesContext.java


示例12: getWrapped

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
/**
 * Returns the wrapped factory.
 */
@Override
public ApplicationFactory getWrapped() {
	return wrapped;
}
 
开发者ID:hatemalimam,项目名称:ChartistJSF,代码行数:8,代码来源:ChartistJSFApplicationFactory.java


示例13: CdiApplicationFactory

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
public CdiApplicationFactory(ApplicationFactory delegate) {
    this.delegate = delegate;
}
 
开发者ID:arievanwi,项目名称:osgi.ee,代码行数:4,代码来源:CdiApplicationFactory.java


示例14: StarterApplicationFactory

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
public StarterApplicationFactory(ApplicationFactory factory) {
	super(factory);
	if (_debug)
		System.out.println(getClass().getName() + " created with delegate");
}
 
开发者ID:OpenNTF,项目名称:BuildAndTestPattern4Xpages,代码行数:6,代码来源:StarterApplicationFactory.java


示例15: OpenNTFApplicationFactory

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
public OpenNTFApplicationFactory(ApplicationFactory factory) {
	super(factory);
	if (_debug)
		System.out.println(getClass().getName() + " created with delegate");
}
 
开发者ID:OpenNTF,项目名称:xsp.extlib,代码行数:6,代码来源:OpenNTFApplicationFactory.java


示例16: getApplication

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
private static Application getApplication() {
    ApplicationFactory appFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
    return appFactory.getApplication();
}
 
开发者ID:mgerlich,项目名称:MetFusion,代码行数:5,代码来源:FacesUtils.java


示例17: initApplication

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
protected void initApplication()
{
    ApplicationFactory applicationFactory =
            (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
    this.application = applicationFactory.getApplication();
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:7,代码来源:MockedJsf2TestContainer.java


示例18: ChartistJSFApplicationFactory

import javax.faces.application.ApplicationFactory; //导入依赖的package包/类
/**
 * Construct a new ChartistJSF application factory around the given wrapped factory.
 * @param wrapped The wrapped factory.
 */
public ChartistJSFApplicationFactory(ApplicationFactory wrapped) {
	this.wrapped = wrapped;
}
 
开发者ID:hatemalimam,项目名称:ChartistJSF,代码行数:8,代码来源:ChartistJSFApplicationFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JobSubmittedEvent类代码示例发布时间:2022-05-22
下一篇:
Java LookAheadLexer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap