Package org.apache.myfaces.context.servlet

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


        String params = " view1:panel1:_component1 view1:panel1:_component2 \n  component3 component4  ";
        Map<String, String> requestParamMap = new HashMap<String, String>();
        requestParamMap.put(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME, params);
        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);

        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
       
        PartialViewContext pprContext = context.getPartialViewContext();
       
        assertTrue("Length must be four", pprContext.getExecuteIds().size() == 4);

        // FIXME: Latest spec uses a Collection so order is not garanteed
//        assertTrue("Value match", pprContext.getExecuteIds().get(0).equals("view1:panel1:_component1"));
View Full Code Here


     * tests the basic render all mechanism,
     * no render all due to defaults
     * or a renderAll which
     */
    public void testRenderAll1() {
        FacesContext context = new FacesContextImpl(servletContext, request, response);
       
        PartialViewContext pprContext = context.getPartialViewContext();

        pprContext.setRenderAll(true);
        assertTrue("override should trigger no matter which condition we have", pprContext.isRenderAll());

        context = new FacesContextImpl(servletContext, request, response);
        pprContext.setRenderAll(false);
        assertFalse("override should trigger no matter which condition we have", pprContext.isRenderAll());
    }
View Full Code Here

        //ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParameterMap);
        FactoryFinder.setFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY,
            "org.apache.myfaces.context.PartialViewContextFactoryImpl");    
        FactoryFinder.setFactory (FactoryFinder.EXCEPTION_HANDLER_FACTORY,
        "org.apache.myfaces.context.ExceptionHandlerFactoryImpl");
        context = new FacesContextImpl(servletContext, request, response);
    }
View Full Code Here

        String empty = "    \n \t  ";
        Map<String, String> requestParamMap = new HashMap<String, String>();
        requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, empty);
        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);

        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
       
        PartialViewContext pprContext = context.getPartialViewContext();

        assertTrue(pprContext.getRenderIds().isEmpty());
    }
View Full Code Here

     */
    public void testRequestParams2() {
        Map<String, String> requestParamMap = new HashMap<String, String>();
        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);

        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
       
        PartialViewContext pprContext = context.getPartialViewContext();

        assertTrue(pprContext.getRenderIds().isEmpty());
    }
View Full Code Here

        String params = " view1:panel1:_component1  ";
        Map<String, String> requestParamMap = new HashMap<String, String>();
        requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, params);
        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);

        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
       
        PartialViewContext pprContext = context.getPartialViewContext();

        assertTrue("Length must be one",pprContext.getRenderIds().size() == 1);
        assertTrue("Value match",pprContext.getRenderIds().iterator().next().equals("view1:panel1:_component1"));
    }
View Full Code Here

        String params = " view1:panel1:_component1 view1:panel1:_component2 \n  component3 component4  ";
        Map<String, String> requestParamMap = new HashMap<String, String>();
        requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, params);
        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);

        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
       
        PartialViewContext pprContext = context.getPartialViewContext();

        assertTrue("Length must be four",pprContext.getRenderIds().size() == 4);

        // FIXME: Latest spec uses a Collection so order is not garanteed
//        assertTrue("Value match",pprContext.getRenderIds().get(0).equals("view1:panel1:_component1"));
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

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

        //ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParameterMap);
        FactoryFinder.setFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY,
            "org.apache.myfaces.context.PartialViewContextFactoryImpl");    
        FactoryFinder.setFactory (FactoryFinder.EXCEPTION_HANDLER_FACTORY,
        "org.apache.myfaces.context.ExceptionHandlerFactoryImpl");
        context = new FacesContextImpl(servletContext, request, response);
    }
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.