Examples of ApplicationAssociate


Examples of com.sun.faces.application.ApplicationAssociate

     */
    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

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

Examples of com.sun.faces.application.ApplicationAssociate

    @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

Examples of com.sun.faces.application.ApplicationAssociate

                                           List<Node> navigationCases,
                                           NavigationHandler navHandler,
                                           ServletContext sc) {

        if (navigationCases != null && !navigationCases.isEmpty()) {
            ApplicationAssociate associate =
                 ApplicationAssociate.getInstance(sc);

            for (Node navigationCase : navigationCases) {
                if (navigationCase.getNodeType() != Node.ELEMENT_NODE) {
                    continue;
                }
                NodeList children = navigationCase.getChildNodes();
                String outcome = null;
                String action = null;
                String condition = null;
                String toViewId = null;
                Map<String,List<String>> parameters = null;
                boolean redirect = false;
                boolean includeViewParams = false;
                for (int i = 0, size = children.getLength(); i < size; i++) {
                    Node n = children.item(i);
                    if (n.getNodeType() == Node.ELEMENT_NODE) {
                        if (FROM_OUTCOME.equals(n.getLocalName())) {
                            outcome = getNodeText(n);
                        } else if (FROM_ACTION.equals(n.getLocalName())) {
                            action = getNodeText(n);
                        } else if (IF.equals(n.getLocalName())) {
                            String expression = getNodeText(n);
                            if (ELUtils.isExpression(expression) && !ELUtils.isMixedExpression(expression)) {
                                condition = expression;
                            }
                            else {
                                if (LOGGER.isLoggable(Level.WARNING)) {
                                    LOGGER.log(Level.WARNING,
                                               "jsf.config.navigation.if_invalid_expression",
                                               new String[] { expression, fromViewId });
                                }
                            }
                        } else if (TO_VIEW_ID.equals(n.getLocalName())) {
                            String toViewIdString = getNodeText(n);
                            if (toViewIdString.charAt(0) != '/' && toViewIdString.charAt(0) != '#') {
                                if (LOGGER.isLoggable(Level.WARNING)) {
                                    LOGGER.log(Level.WARNING,
                                               "jsf.config.navigation.to_view_id_leading_slash",
                                               new String[] { toViewIdString,
                                                              fromViewId });
                                }
                                toViewId = '/' + toViewIdString;
                            } else {
                                toViewId = toViewIdString;
                            }
                        } else if (REDIRECT.equals(n.getLocalName())) {
                            parameters = processParameters(n.getChildNodes());
                            includeViewParams = isIncludeViewParams(n);
                            redirect = true;
                        }
                    }
                }

                NavigationCase cnc =
                     new NavigationCase(fromViewId,
                                        action,
                                        outcome,
                                        condition,
                                        toViewId,
                                        parameters,
                                        redirect,
                                        includeViewParams);
                if (LOGGER.isLoggable(Level.FINE)) {
                    LOGGER.log(Level.FINE,
                               MessageFormat.format("Adding NavigationCase: {0}",
                                                    cnc.toString()));
                }

                // if the top-level NavigationHandler is an instance of
                // ConfigurableNavigationHandler, add the NavigationCases to
                // that instance as well as adding them to the application associate.
                // We have to add them to the ApplicationAssociate in the case
                // where the top-level NavigationHandler may be custom and delegates
                // to the default NavigationHandler implementation.  In 1.2, they
                // could be guaranteed that the default implementation had all
                // defined navigation mappings.
                if (navHandler instanceof ConfigurableNavigationHandler) {
                    ConfigurableNavigationHandler cnav = (ConfigurableNavigationHandler) navHandler;
                    Set<NavigationCase> cases = cnav.getNavigationCases().get(fromViewId);
                    if (cases == null) {
                        cases = new LinkedHashSet<NavigationCase>();
                        cnav.getNavigationCases().put(fromViewId, cases);
                    }
                    cases.add(cnc);
                }
                associate.addNavigationCase(cnc);
               
            }


        }
View Full Code Here

Examples of com.sun.faces.application.ApplicationAssociate

    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

Examples of com.sun.faces.application.ApplicationAssociate

        HttpSession session = hse.getSession();
        Map<String, Object> activeViewMaps = (Map<String, Object>) session.getAttribute(ACTIVE_VIEW_MAPS);
        if (activeViewMaps != null) {
            Iterator<Object> activeViewMapsIterator = activeViewMaps.values().iterator();
            ApplicationAssociate applicationAssociate = ApplicationAssociate.getInstance(hse.getSession().getServletContext());
            while (activeViewMapsIterator.hasNext()) {
                Map<String, Object> viewMap = (Map<String, Object>) activeViewMapsIterator.next();
                destroyBeans(applicationAssociate, viewMap);
            }
View Full Code Here

Examples of com.sun.faces.application.ApplicationAssociate

        UIViewRoot result = null;

        try {
            context.setProcessingEvents(false);
            if (faceletFactory == null) {
                ApplicationAssociate associate = ApplicationAssociate
                      .getInstance(context.getExternalContext());
                faceletFactory = associate.getFaceletFactory();
                assert (faceletFactory != null);
            }
            ViewHandler vh = context.getApplication().getViewHandler();
            result = vh.createView(context, viewId);
View Full Code Here

Examples of com.sun.faces.application.ApplicationAssociate

     */
    public void destroyBeans(FacesContext facesContext, Map<String, Object> viewMap) {
        if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.log(Level.FINEST, "Destroying @ViewScoped beans from view map: {0}", viewMap);
        }
        ApplicationAssociate applicationAssociate = ApplicationAssociate.getInstance(facesContext.getExternalContext());
        if (applicationAssociate != null) {
            destroyBeans(applicationAssociate, viewMap);
        }
    }
View Full Code Here

Examples of com.sun.faces.application.ApplicationAssociate

            throw new XPathExpressionException("<faces-config> must have at most one <name> element.");
        }
        if (null != nameList && 1 == nameList.getLength()) {
            nameStr = nameList.item(0).getNodeValue().trim();
            if (0 < nameStr.length()) {
                ApplicationAssociate associate = ApplicationAssociate.getInstance(context.getExternalContext());
                try {
                    associate.relateUrlToDefiningDocumentInJar(definingDocumentURI.toURL(), nameStr);
                } catch (MalformedURLException ex) {
                    throw new XPathExpressionException(ex);
                }
            }
        }
View Full Code Here

Examples of com.sun.faces.application.ApplicationAssociate

     */
    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
TOP
Copyright © 2018 www.massapi.com. 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.