Examples of FastWriter


Examples of org.apache.myfaces.view.facelets.util.FastWriter

        return this.txt.toString();
    }

    public String getText(FaceletContext ctx)
    {
        Writer writer = new FastWriter(this.length);
        try
        {
            this.txt.apply(ctx.getExpressionFactory(), ctx).write(writer, ctx);
        }
        catch (IOException e)
        {
            throw new ELException(this.alias + ": " + e.getMessage(), e.getCause());
        }
        return writer.toString();
    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.util.FastWriter

    {
        if (!this.writtenState)
        {
            this.writtenState = true;
            this.writtenStateWithoutWrapper = false;
            this.out = this.fast = new FastWriter(this.initialSize);
        }
    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.util.FastWriter

        return this.txt.toString();
    }

    public String getText(FaceletContext ctx)
    {
        Writer writer = new FastWriter(this.length);
        try
        {
            this.txt.apply(ctx.getExpressionFactory(), ctx).write(writer, ctx);
        }
        catch (IOException e)
        {
            throw new ELException(this.alias + ": " + e.getMessage(), e.getCause());
        }
        return writer.toString();
    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.util.FastWriter

        request.setAttribute("test", "foo");
       
        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root, "test-tags.xml");
       
        FastWriter fw = new FastWriter();
        MockResponseWriter mrw = new MockResponseWriter(fw);
        facesContext.setResponseWriter(mrw);
        root.encodeAll(facesContext);
        //System.out.println(fw);
    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.util.FastWriter

    public void testUserTag1() throws Exception
    {
        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root, "usertagtest1.xhtml");
       
        FastWriter fw = new FastWriter();
        ResponseWriter rw = facesContext.getResponseWriter();
        rw = rw.cloneWithWriter(fw);
        facesContext.setResponseWriter(rw);
        root.encodeAll(facesContext);
        rw.flush();
       
        String result = fw.toString();
        Assert.assertTrue("Output should contain 'value1'", result.contains("value1"));
        Assert.assertFalse("Output should not contain 'value2'", result.contains("value2"));
        Assert.assertFalse("Output should not contain 'value3'", result.contains("value3"));
    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.util.FastWriter

    public void testUserTag2() throws Exception
    {
        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root, "usertagtest2.xhtml");
       
        FastWriter fw = new FastWriter();
        ResponseWriter rw = facesContext.getResponseWriter();
        rw = rw.cloneWithWriter(fw);
        facesContext.setResponseWriter(rw);
        root.encodeAll(facesContext);
        rw.flush();
       
        String result = fw.toString();
        Assert.assertTrue("Output should contain 'value2'", result.contains("value2"));
        Assert.assertFalse("Output should not contain 'value3'", result.contains("value3"));
        Assert.assertFalse("Output should not contain 'value1'", result.contains("value1"));
    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.util.FastWriter

        System.out.println("ApplicationImpl:" + facesContext.getApplication().getClass().getName());
        System.out.println("ExpressionFactory:" + facesContext.getApplication().getExpressionFactory().getClass().getName());
       
        vdl.buildView(facesContext, root, "test1.xml");

        FastWriter fw = new FastWriter();
        ResponseWriter rw = facesContext.getResponseWriter();
        rw = rw.cloneWithWriter(fw);
        facesContext.setResponseWriter(rw);
        root.encodeAll(facesContext);
       
        String result = fw.toString();
       
        Assert.assertTrue("Output:" + result, result.contains("<p>Component value:page test2</p>"));
        Assert.assertTrue("Output:" + result,result.contains("<p>Inline EL value: page test2</p>"));
       
        //System.out.println(fw);

        ComponentSupport.removeTransient(root);

        request.setAttribute("test", "test3.xml");

        facesContext.setViewRoot(facesContext.getApplication().getViewHandler()
                .createView(facesContext, "/test"));
        root = facesContext.getViewRoot();

        vdl.buildView(facesContext, root, "test1.xml");

        fw = new FastWriter();
        rw = facesContext.getResponseWriter();
        rw = rw.cloneWithWriter(fw);
        facesContext.setResponseWriter(rw);
        root.encodeAll(facesContext);
        rw.flush();
        //System.out.println(fw);
       
        result = fw.toString();
       
        Assert.assertTrue("Output:" + result, result.contains("<p>Component value:page test3</p>"));
        Assert.assertTrue("Output:" + result, result.contains("<p>Inline EL value: page test3</p>"));

    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.util.FastWriter

    public void testSimpleCompositionParam() throws Exception
    {
        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root, "simpleCompositionParam.xhtml");
       
        FastWriter fw = new FastWriter();
        ResponseWriter rw = facesContext.getResponseWriter();
        rw = rw.cloneWithWriter(fw);
        facesContext.setResponseWriter(rw);
        root.encodeAll(facesContext);
        rw.flush();
       
        String result = fw.toString();
        Assert.assertTrue("Output:" + result, result.contains("value1"));
    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.util.FastWriter

    public void testUIParamTemplateScope1() throws Exception
    {
        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root, "uiparamtemplatescope1.xhtml");
       
        FastWriter fw = new FastWriter();
        ResponseWriter rw = facesContext.getResponseWriter();
        rw = rw.cloneWithWriter(fw);
        facesContext.setResponseWriter(rw);
        root.encodeAll(facesContext);
        rw.flush();
       
        String result = fw.toString();
        Assert.assertTrue("Output should contain 'rightValue'", result.contains("rightValue"));
        Assert.assertFalse("Output should not contain 'doNotPrintValue'", result.contains("doNotPrintValue"));
    }
View Full Code Here

Examples of org.apache.solr.common.util.FastWriter

        } else {
          String charset = ContentStreamBase.getCharsetFromContentType(ct);
          Writer out = (charset == null || charset.equalsIgnoreCase("UTF-8"))
            ? new OutputStreamWriter(response.getOutputStream(), UTF8)
            : new OutputStreamWriter(response.getOutputStream(), charset);
          out = new FastWriter(out);
          responseWriter.write(out, solrReq, solrRsp);
          out.flush();
        }
      }
      //else http HEAD request, nothing to write out, waited this long just to get ContentType
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.