Package org.apache.myfaces.context.servlet

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


        ByteArrayOutputStream ostrWriter = new ByteArrayOutputStream();
        PrintWriter writer = new PrintWriter(ostrWriter);
        ServletOutputStreamMock sOstr = new ServletOutputStreamMock(ostr);
        NewStreamingMockResponse resp = new NewStreamingMockResponse(response, sOstr, writer);

        FacesContext context = new FacesContextImpl(servletContext, request, resp);


        ResponseWriter responseWriter = context.getResponseWriter();
        if (responseWriter == null) {
            try {
                responseWriter = new MockResponseWriter(((ServletResponse) context.getExternalContext().getResponse()).getWriter(), null, null);
            } catch (IOException ex) {
                super.fail(ex.getMessage());
            }
            context.setResponseWriter(responseWriter);
        }



        assertTrue("responsewriter not null", responseWriter != null);
View Full Code Here


        //if (context instanceof ServletContext)
        //{
            FacesContext facesContext;
            if (externalContext instanceof ReleaseableExternalContext)
            {
                facesContext = new FacesContextImpl(externalContext, (ReleaseableExternalContext) externalContext,
                                                    this, _applicationFactory, _renderKitFactory,
                                                    _partialViewContextFactory);
            }
            else if (defaultExternalContext != null && defaultExternalContext instanceof ReleaseableExternalContext)
            {
                facesContext = new FacesContextImpl(externalContext,
                                                    (ReleaseableExternalContext) defaultExternalContext, this,
                                                    _applicationFactory, _renderKitFactory,
                                                    _partialViewContextFactory);
            }
            else
            {
                facesContext = new FacesContextImpl(externalContext, null, this,
                                                    _applicationFactory, _renderKitFactory,
                                                    _partialViewContextFactory);
            }
           
            facesContext.setExceptionHandler(_exceptionHandlerFactory.getExceptionHandler());
View Full Code Here

        //if (context instanceof ServletContext)
        //{
            FacesContext facesContext;
            if (externalContext instanceof ReleaseableExternalContext)
            {
                facesContext = new FacesContextImpl(externalContext, (ReleaseableExternalContext) externalContext,
                                                    this, _applicationFactory, _renderKitFactory,
                                                    _partialViewContextFactory);
            }
            else if (defaultExternalContext != null && defaultExternalContext instanceof ReleaseableExternalContext)
            {
                facesContext = new FacesContextImpl(externalContext,
                                                    (ReleaseableExternalContext) defaultExternalContext, this,
                                                    _applicationFactory, _renderKitFactory,
                                                    _partialViewContextFactory);
            }
            else
            {
                facesContext = new FacesContextImpl(externalContext, null, this,
                                                    _applicationFactory, _renderKitFactory,
                                                    _partialViewContextFactory);
            }
           
            facesContext.setExceptionHandler(_exceptionHandlerFactory.getExceptionHandler());
View Full Code Here

        ByteArrayOutputStream ostrWriter = new ByteArrayOutputStream();
        PrintWriter writer = new PrintWriter(ostrWriter);
        ServletOutputStreamMock sOstr = new ServletOutputStreamMock(ostr);
        NewStreamingMockResponse resp = new NewStreamingMockResponse(response, sOstr, writer);

        FacesContext context = new FacesContextImpl(servletContext, request, resp);


        ResponseWriter responseWriter = context.getResponseWriter();
        if (responseWriter == null) {
            try {
                responseWriter = new MockResponseWriter(((ServletResponse) context.getExternalContext().getResponse()).getWriter(), null, null);
            } catch (IOException ex) {
                super.fail(ex.getMessage());
            }
            context.setResponseWriter(responseWriter);
        }



        assertTrue("responsewriter not null", responseWriter != null);
View Full Code Here

        //{
        //    externalContext = new PortletExternalContextImpl(context,
        //            request, response);
        //}
       
        facesContext = new FacesContextImpl(externalContext,this);
       
        if (facesContext != null)
        {
            if (_firstExternalContextInstance != null)
            {
View Full Code Here

        setPortletRequestFlag(request);

        try
        {
            FacesContextImpl facesContext = (FacesContextImpl)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.FacesContextImpl

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.