Package org.apache.myfaces.context.servlet

Examples of org.apache.myfaces.context.servlet.ServletFacesContextImpl


            throw new NullPointerException("lifecycle");
        }

        if (context instanceof ServletContext)
        {
            return new ServletFacesContextImpl((ServletContext)context,
                                               (ServletRequest)request,
                                               (ServletResponse)response);
        }
       
        if (context instanceof PortletContext)
        {
            return new ServletFacesContextImpl((PortletContext)context,
                                               (PortletRequest)request,
                                               (PortletResponse)response);
        }
       
        throw new FacesException("Unsupported context type " + context.getClass().getName());
View Full Code Here


        StartupServletContextListener.initFaces(_servletContext);

        _httpServletRequest = new ServletRequestMockImpl(getCookies());
        _httpServletResponse = new ServletResponseMockImpl();

        _facesContext = new ServletFacesContextImpl(_servletContext,
                                                    _httpServletRequest,
                                                    _httpServletResponse);
        _application = _facesContext.getApplication();
    }
View Full Code Here

        ((ServletRequestMockImpl)_httpServletRequest).setServletPath(servletPath);
        ((ServletRequestMockImpl)_httpServletRequest).setPathInfo(pathInfo);

        //Standard implementation caches servlet path, so we must create a new FacesContext
        //for each test:
        _facesContext = new ServletFacesContextImpl(_servletContext,
                                                    _httpServletRequest,
                                                    _httpServletResponse);

        JspViewHandlerImpl viewHandler = new JspViewHandlerImpl();
        String viewpath = viewHandler.getViewIdPath(_facesContext, viewId);
View Full Code Here

//        if (sessionTimedOut(request)) return;
        boolean isSessionTimeOut = sessionTimedOut(request);

        setPortletRequestFlag(request);

        ServletFacesContextImpl facesContext = (ServletFacesContextImpl) facesContext(request, response);

        if (isSessionTimeOut) {
            ApplicationFactory appFactory =
                    (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
            Application application = appFactory.getApplication();
            ViewHandler viewHandler = application.getViewHandler();
            String viewId = (String) facesContext.getExternalContext().getRequestParameterMap().get("jsf_viewid");
            UIViewRoot viewRoot = viewHandler.createView(facesContext, viewId);
            viewRoot.setViewId(viewId);
            facesContext.setViewRoot(viewRoot);

            if (!facesContext.getResponseComplete()) {
                response.setRenderParameter(VIEW_ID, viewId);
            }

            try {
                if (facesContext.getResponseComplete()) return;
                facesContext.setExternalContext(makeExternalContext(request, response));
                request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, facesContext);

            }
            catch (Throwable e) {
                handleExceptionFromLifecycle(e);
            }

        } else {
            try {
                lifecycle.execute(facesContext);

                if (!facesContext.getResponseComplete()) {
                    response.setRenderParameter(VIEW_ID, facesContext.getViewRoot().getViewId());
                }

                request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, facesContext);
            }
            catch (Throwable e) {
                facesContext.release();
                handleExceptionFromLifecycle(e);
            }
        }
    }
View Full Code Here

        }

        setPortletRequestFlag(request);

        try {
            ServletFacesContextImpl facesContext = (ServletFacesContextImpl) request.
                    getPortletSession().
                    getAttribute(CURRENT_FACES_CONTEXT);

            // TODO: not sure if this can happen.  Also double check this against spec section 2.1.3
            if (facesContext.getResponseComplete()) return;

            facesContext.setExternalContext(makeExternalContext(request, response));
            lifecycle.render(facesContext);
        }
        catch (Throwable e) {
            handleExceptionFromLifecycle(e);
        }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.context.servlet.ServletFacesContextImpl

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.