Package javax.faces.application

Examples of javax.faces.application.ViewHandler


            root.setViewId(viewId);
            return root;
        }

        UIViewRoot result = super.createView(ctx, viewId);
        ViewHandler viewHandler = ctx.getApplication().getViewHandler();
        ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(ctx, viewId);

        ctx.setResourceLibraryContracts(vdl.calculateResourceLibraryContracts(ctx, viewId));
       
        return result;
       
View Full Code Here


        // PENDING: this code is optimized to be fast to write.
        // It must be optimized to be fast to run.
       
        // See git clone ssh://edburns@git.java.net/grizzly~git 1_9_36 for
        // how grizzly does this.
        ViewHandler viewHandler = context.getApplication().getViewHandler();
        Set<String> urlPatterns = viewHandler.getProtectedViewsUnmodifiable();
        // Implement section 12.1 of the Servlet spec.
        boolean viewIdIsProtected = false;
        for (String cur : urlPatterns) {
            if (cur.equals(viewId)) {
                viewIdIsProtected = true;
            }
            if (viewIdIsProtected) {
                break;
            }
        }
        if (viewIdIsProtected) {
            StringBuilder builder = new StringBuilder(result);
            // If the result already has a query string...
            if (result.contains("?")) {
                // ...assume it also has one or more parameters, and
                // append an additional parameter.
                builder.append("&");
            } else {
                // Otherwise, this is the first parameter in the result.
                builder.append("?");
            }
           
            String rkId = viewHandler.calculateRenderKitId(context);
            ResponseStateManager rsm = RenderKitUtils.getResponseStateManager(context, rkId);
            String tokenValue = rsm.getCryptographicallyStrongTokenFromSession(context);
            builder.append(ResponseStateManager.NON_POSTBACK_VIEW_TOKEN_PARAM).
                    append("=").append(tokenValue);
            result = builder.toString();
View Full Code Here

        // Get Application instance
        Application application = context.getApplication();
        assert (application != null);

        // Get the ViewHandler
        ViewHandler viewHandler = application.getViewHandler();
        assert (viewHandler != null);

        return viewHandler;
    }
View Full Code Here

            } catch (IOException ioe) {
                throw new FacesException(ioe);
            }
        } else {
            // this is necessary to allow decorated impls.
            ViewHandler outerViewHandler =
                    context.getApplication().getViewHandler();
            String renderKitId =
                    outerViewHandler.calculateRenderKitId(context);
            viewRoot = Util.getStateManager(context).restoreView(context,
                                                                 viewId,
                                                                 renderKitId);
        }
View Full Code Here

            }
            if (navigationCase.isRedirect() &&
                (!PortletUtil.isPortletRequest(facesContext)))
            { // Spec section 7.4.2 says "redirects not possible" in this case for portlets
                ExternalContext externalContext = facesContext.getExternalContext();
                ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
                String redirectPath = viewHandler.getActionURL(facesContext, navigationCase.getToViewId());

                try
                {
                    externalContext.redirect(externalContext.encodeActionURL(redirectPath));
                }
                catch (IOException e)
                {
                    throw new FacesException(e.getMessage(), e);
                }
            }
            else
            {
                ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
                //create new view
                String newViewId = navigationCase.getToViewId();
                UIViewRoot viewRoot = viewHandler.createView(facesContext, newViewId);
                facesContext.setViewRoot(viewRoot);
                facesContext.renderResponse();
            }
        }
        else
View Full Code Here

        if (log.isTraceEnabled()) log.trace("Non-faces request: contextPath = " + request.getContextPath());
        setContentType(request, response); // do this in case nonFacesRequest is called by a subclass
        ApplicationFactory appFactory =
            (ApplicationFactory)FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
        Application application = appFactory.getApplication();
        ViewHandler viewHandler = application.getViewHandler();
        FacesContext facesContext = facesContext(request, response);
        UIViewRoot viewRoot = viewHandler.createView(facesContext, view);
        viewRoot.setViewId(view);
        facesContext.setViewRoot(viewRoot);
        lifecycle.render(facesContext);
    }
View Full Code Here

                    }
                }
            }

            Application application = facesContext.getApplication();
            ViewHandler viewHandler = application.getViewHandler();

            //boolean viewCreated = false;
            UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewId);
            if (viewRoot == null)
            {
                viewRoot = viewHandler.createView(facesContext, viewId);
                viewRoot.setViewId(viewId);
                facesContext.renderResponse();
                //viewCreated = true;
            }
View Full Code Here

            if(isResponseComplete(facesContext, "render", true))
            {
                            return;
            }
            Application application = facesContext.getApplication();
            ViewHandler viewHandler = application.getViewHandler();

            try
            {
                viewHandler.renderView(facesContext, facesContext.getViewRoot());
            }
            catch (IOException e)
            {
                throw new FacesException(e.getMessage(), e);
            }
View Full Code Here

    // in the subsequent render request(s).

    String viewId = context.getViewRoot().getViewId();

    // don't care about the return as it means nothing
    ViewHandler viewHandler = context.getApplication().getViewHandler();
    String viewURL = viewHandler.getActionURL(context, viewId);
    context.getExternalContext().encodeActionURL(viewURL);

  }
View Full Code Here

        LOG.debug("*** '" + entry.getKey() + "' -> '" + entry.getValue() + "'");
      }
    }

    Application application = facesContext.getApplication();
    ViewHandler viewHandler = application.getViewHandler();
    String viewId = facesContext.getViewRoot().getViewId();
    String formAction = viewHandler.getActionURL(facesContext, viewId);
    formAction = facesContext.getExternalContext().encodeActionURL(formAction);
    String contentType = writer.getContentTypeWithCharSet();
    ResponseUtils.ensureContentTypeHeader(facesContext, contentType);
    String clientId = page.getClientId(facesContext);
    final ClientProperties client = VariableResolverUtils.resolveClientProperties(facesContext);
View Full Code Here

TOP

Related Classes of javax.faces.application.ViewHandler

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.