Package com.sun.faces.application

Examples of com.sun.faces.application.ApplicationAssociate


        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Building View: " + view.getViewId());
        }
        if (faceletFactory == null) {
            ApplicationAssociate associate = ApplicationAssociate.getInstance(ctx.getExternalContext());
            faceletFactory = associate.getFaceletFactory();
            assert (faceletFactory != null);
        }
        RequestStateManager.set(ctx,
                                RequestStateManager.FACELET_FACTORY,
                                faceletFactory);
View Full Code Here


    @Override
    public boolean viewExists(FacesContext context,
                              String viewId) {
        if (handlesViewId(viewId)) {
            if (faceletFactory == null) {
                ApplicationAssociate associate = ApplicationAssociate.getInstance(context.getExternalContext());
                faceletFactory = associate.getFaceletFactory();
                assert (faceletFactory != null);
            }
          
            return faceletFactory.getResourceResolver().resolveUrl(viewId) != null;
        }
View Full Code Here

     */
    public static StateContext getStateContext(FacesContext ctx) {

        StateContext stateCtx = (StateContext) ctx.getAttributes().get(KEY);
        if (stateCtx == null) {
            ApplicationAssociate associate = ApplicationAssociate.getCurrentInstance();
            ApplicationStateInfo info = associate.getApplicationStateInfo();
            stateCtx = new StateContext(info);
            ctx.getAttributes().put(KEY, stateCtx);
        }
        return stateCtx;

View Full Code Here

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("Building View: " + view.getViewId());
        }
        if (faceletFactory == null) {
            ApplicationAssociate associate = ApplicationAssociate.getInstance(ctx.getExternalContext());
            faceletFactory = associate.getFaceletFactory();
            assert (faceletFactory != null);
        }
        RequestStateManager.set(ctx,
                                RequestStateManager.FACELET_FACTORY,
                                faceletFactory);
View Full Code Here

                    Flow currentFlow = fh.getCurrentFlow(context);
                    do {
                        if (null != currentFlow && 0 < currentFlow.getDefiningDocumentId().length()) {
                            String definingDocumentId = currentFlow.getDefiningDocumentId();
                            ExternalContext extContext = context.getExternalContext();
                            ApplicationAssociate associate = ApplicationAssociate.getInstance(extContext);
                            if (associate.urlIsRelatedToDefiningDocumentInJar(url, definingDocumentId)) {
                                keepGoing = false;
                                doNotCache = true;
                            } else {
                                if (matches.hasMoreElements()) {
                                    url = matches.nextElement();
View Full Code Here

    private Class<?> loadBeanClass() {
        if (beanClass == null) {
            String className = beanInfo.getClassName();
            Class<?> clazz = loadClass(className);
            ApplicationAssociate associate =
                  ApplicationAssociate.getCurrentInstance();          

            if (!associate.isDevModeEnabled()) {
                beanClass = clazz;
            }

            // validate the bean class is public and has a public
            // no-arg ctor
View Full Code Here

                    }
                    LOGGER.severe(sb.toString());
                }              
            }
            registerELResolverAndListenerWithJsp(context, false);
            ApplicationAssociate associate =
                 ApplicationAssociate.getInstance(context);
            if (associate != null) {
                associate.setContextName(getServletContextIdentifier(context));
            }
            RenderKitUtils.loadSunJsfJs(initContext.getExternalContext());
           
        } finally {
            Verifier.setCurrentInstance(null);
View Full Code Here

                                   session.getId());
                    }
                    session.invalidate();
                }
            }
            ApplicationAssociate associate = ApplicationAssociate.getInstance(sc);
            if (associate != null) {
                BeanManager manager = associate.getBeanManager();
                for (Map.Entry<String,BeanBuilder> entry : manager.getRegisteredBeans().entrySet()) {
                    String name = entry.getKey();
                    BeanBuilder bean = entry.getValue();
                    if (bean.getScope() == ELUtils.Scope.APPLICATION) {
                        if (LOGGER.isLoggable(Level.INFO)) {
                            LOGGER.log(Level.INFO,
                                       "Removing application scoped managed bean: {0}",
                                       name);
                        }
                        sc.removeAttribute(name);
                    }

                }
            }
            // Release any allocated application resources
            FactoryFinder.releaseFactories();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            FacesContext initContext = new InitFacesContext(sc);
            ApplicationAssociate
                  .clearInstance(initContext.getExternalContext());
            ApplicationAssociate.setCurrentInstance(null);
            // Release the initialization mark on this web application
            ConfigManager.getInstance().destory(sc);
            initContext.release();
            ReflectionUtils.clearCache(Thread.currentThread().getContextClassLoader());
            WebConfiguration.clear(sc);
        }

        // bring the application back up, avoid re-registration of certain JSP
        // artifacts.  No verification will be performed either to make this
        // light weight.

        // init a new WebAppLifecycleListener so that the cached ApplicationAssociate
        // is removed.
        webAppListener = new WebappLifecycleListener(sc);

        FacesContext initContext = new InitFacesContext(sc);
        ReflectionUtils
              .initCache(Thread.currentThread().getContextClassLoader());

        try {
            ConfigManager configManager = ConfigManager.getInstance();
            configManager.initialize(sc);


            registerELResolverAndListenerWithJsp(sc, true);
            ApplicationAssociate associate =
                  ApplicationAssociate.getInstance(sc);
            if (associate != null) {
                associate.setContextName(getServletContextIdentifier(sc));
            }
            RenderKitUtils.loadSunJsfJs(initContext.getExternalContext());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
View Full Code Here

           
            // register an empty resolver for now. It will be populated after the
            // first request is serviced.
            CompositeELResolver compositeELResolverForJsp =
                new FacesCompositeELResolver(FacesCompositeELResolver.ELResolverChainType.JSP);
            ApplicationAssociate associate =
                     ApplicationAssociate.getInstance(context);
            if (associate != null) {
                associate.setFacesELResolverForJsp(compositeELResolverForJsp);
            }
                   
            // get JspApplicationContext.
            JspApplicationContext jspAppContext = JspFactory.getDefaultFactory()
                    .getJspApplicationContext(context);
   
            // cache the ExpressionFactory instance in ApplicationAssociate
            if (associate != null) {
                associate.setExpressionFactory(jspAppContext.getExpressionFactory());
            }
   
            // register compositeELResolver with JSP
            try {
                jspAppContext.addELResolver(compositeELResolverForJsp);
View Full Code Here

            return false;
        }
        try {
            ExpressionFactory factory = (ExpressionFactory)
                  Util.loadClass(elFactoryType, this).newInstance();
            ApplicationAssociate associate =
                 ApplicationAssociate.getInstance(sc);
            if (associate != null) {
                associate.setExpressionFactory(factory);
            }
            return true;
        } catch (Exception e) {
            LOGGER.severe(MessageFormat.format("Unable to instantiate ExpressionFactory ''{0}''",
                                               elFactoryType));
View Full Code Here

TOP

Related Classes of com.sun.faces.application.ApplicationAssociate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.