javax.faces.application.ApplicationFactory Java Examples
The following examples show how to use
javax.faces.application.ApplicationFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TemplateBaseListener.java From sakai with Educational Community License v2.0 | 5 votes |
/** * 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; }
Example #2
Source File: ContextUtil.java From sakai with Educational Community License v2.0 | 5 votes |
/** * 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; }
Example #3
Source File: ContextUtil.java From sakai with Educational Community License v2.0 | 5 votes |
/** * 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; }
Example #4
Source File: CustomSelectOneRadioTag.java From sakai with Educational Community License v2.0 | 5 votes |
public ValueBinding getValueBinding(String valueRef) { ApplicationFactory af = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); Application a = af.getApplication(); return (a.createValueBinding(valueRef)); }
Example #5
Source File: SignupServlet.java From sakai with Educational Community License v2.0 | 5 votes |
/** * 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; }
Example #6
Source File: TemplateBaseListener.java From sakai with Educational Community License v2.0 | 5 votes |
/** * 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; }
Example #7
Source File: ContextUtil.java From sakai with Educational Community License v2.0 | 5 votes |
/** * 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; }
Example #8
Source File: ContextUtil.java From sakai with Educational Community License v2.0 | 5 votes |
/** * 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; }
Example #9
Source File: CustomSelectOneRadioTag.java From sakai with Educational Community License v2.0 | 5 votes |
public ValueBinding getValueBinding(String valueRef) { ApplicationFactory af = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); Application a = af.getApplication(); return (a.createValueBinding(valueRef)); }
Example #10
Source File: SignupServlet.java From sakai with Educational Community License v2.0 | 5 votes |
/** * 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; }
Example #11
Source File: ChartistJSFApplicationFactory.java From ChartistJSF with Apache License 2.0 | 4 votes |
/** * Returns the wrapped factory. */ @Override public ApplicationFactory getWrapped() { return wrapped; }
Example #12
Source File: MockedJsf2TestContainer.java From deltaspike with Apache License 2.0 | 4 votes |
protected void initApplication() { ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); this.application = applicationFactory.getApplication(); }
Example #13
Source File: ChartistJSFApplicationFactory.java From ChartistJSF with Apache License 2.0 | 2 votes |
/** * Construct a new ChartistJSF application factory around the given wrapped factory. * @param wrapped The wrapped factory. */ public ChartistJSFApplicationFactory(ApplicationFactory wrapped) { this.wrapped = wrapped; }