Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.ResponseBuilder


        String namespace = _response.getNamespace();

        IMarkupWriter nested = writer.getNestedWriter();
       
        ResponseBuilder builder = new DefaultResponseBuilder(nested);
       
        PageRenderSupportImpl support = new PageRenderSupportImpl(
                _assetFactory, namespace, null, builder);

        TapestryUtils.storePageRenderSupport(cycle, support);
       
        builder.renderResponse(cycle);
       
        String id = "Tapestry Portlet " + _applicationId + " " + namespace;

        writer.comment("BEGIN " + id);
        writer.comment("Page: " + page.getPageName());
View Full Code Here


    public void test_Null_Render()
    {
        IRender render = (IRender)newMock(IRender.class);
        IRequestCycle cycle = (IRequestCycle)newMock(IRequestCycle.class);
       
        ResponseBuilder builder = new DefaultResponseBuilder(null);
       
        render.render(null, cycle);
       
        replay();
       
        builder.render(null, render, cycle);
       
        verify();
       
        assertSame(builder.getWriter(), NullWriter.getSharedInstance());
    }
View Full Code Here

    {
        IRender render = (IRender)newMock(IRender.class);
        IRequestCycle cycle = (IRequestCycle)newMock(IRequestCycle.class);
        IMarkupWriter writer = (IMarkupWriter)newMock(IMarkupWriter.class);
       
        ResponseBuilder builder = new DefaultResponseBuilder(writer);
       
        render.render(writer, cycle);
       
        replay();
       
        builder.render(null, render, cycle);
       
        verify();
       
        assertSame(builder.getWriter(), writer);
    }
View Full Code Here

    }
   
    public void test_Get_Writer_Type()
    {
        IMarkupWriter writer = (IMarkupWriter)newMock(IMarkupWriter.class);
        ResponseBuilder builder = new DefaultResponseBuilder(writer);
       
        assertSame(builder.getWriter("test", "type"), writer);
    }
View Full Code Here

    }
   
    public void test_Allowed_Scripts()
    {
        IComponent component = (IComponent)newMock(IComponent.class);
        ResponseBuilder builder = new DefaultResponseBuilder(null);
       
        assertTrue(builder.isBodyScriptAllowed(component));
        assertTrue(builder.isExternalScriptAllowed(component));
        assertTrue(builder.isInitializationScriptAllowed(component));
    }
View Full Code Here

        IRequestCycle cycle = (IRequestCycle)newMock(IRequestCycle.class);
       
        replay();
       
        IMarkupWriter mw = new MarkupWriterImpl("text/html", writer, filter);
        ResponseBuilder builder = new DefaultResponseBuilder(mw);
       
        String bscript = "var e=4;";
        String imageInit = "image initializations";
        String preload = "preloadedvarname";
       
        verify();
        replay();
       
        builder.beginBodyScript(mw, cycle);
       
        assertOutput("<script type=\"text/javascript\"><!--"+LINE_SEPARATOR);
       
        builder.writeImageInitializations(mw, imageInit, preload, cycle);
       
        assertOutput(LINE_SEPARATOR
                + "dojo.addOnLoad(function(e) {\n"
                + preload + " = [];\n"
                + "if (document.images)\n"
                + "{\n" + imageInit + "}\n"
                + "});");
       
        builder.writeBodyScript(mw, bscript, cycle);
       
        assertOutput(bscript);
       
        builder.endBodyScript(mw, cycle);
       
        assertOutput(LINE_SEPARATOR + "// --></script>");
       
        verify();
    }
View Full Code Here

        IRequestCycle cycle = (IRequestCycle)newMock(IRequestCycle.class);
       
        replay();
       
        IMarkupWriter mw = new MarkupWriterImpl("text/html", writer, filter);
        ResponseBuilder builder = new DefaultResponseBuilder(mw);
       
        String script1 = "http://noname/js/package.js";
        String script2 = "http://noname/js/package.js";
       
        verify();
        replay();
       
        builder.writeExternalScript(mw, script1, cycle);
       
        assertOutput("<script type=\"text/javascript\" src=\""
                + script1 + "\"></script>" + LINE_SEPARATOR);
       
        builder.writeExternalScript(mw, script2, cycle);
       
        assertOutput("<script type=\"text/javascript\" src=\""
                + script2 + "\"></script>" + LINE_SEPARATOR);
       
        verify();
View Full Code Here

        PrintWriter writer = newPrintWriter();
       
        replay();
       
        IMarkupWriter mw = new MarkupWriterImpl("text/html", writer, filter);
        ResponseBuilder builder = new DefaultResponseBuilder(mw);
       
        String script = "doThisInInit();";
       
        verify();
        replay();
       
        builder.writeInitializationScript(mw, script);
       
        assertOutput("<script type=\"text/javascript\"><!--\n"
                + "dojo.addOnLoad(function(e) {\n"
                + script
                + "});"
View Full Code Here

    {
        IRender render = newMock(IRender.class);
        IRequestCycle cycle = newMock(IRequestCycle.class);
        IMarkupWriter writer = newWriter();

        ResponseBuilder builder = new DojoAjaxResponseBuilder(cycle, writer, null);

        render.render(NullWriter.getSharedInstance(), cycle);

        replay();

        builder.render(writer, render, cycle);

        verify();

        assertSame(builder.getWriter(), writer);
    }
View Full Code Here

    {
        IRender render = newMock(IRender.class);
        IRequestCycle cycle = newMock(IRequestCycle.class);
        IMarkupWriter writer = newMock(IMarkupWriter.class);

        ResponseBuilder builder = new DojoAjaxResponseBuilder(cycle, writer, null);

        render.render(NullWriter.getSharedInstance(), cycle);

        replay();

        builder.render(null, render, cycle);

        verify();

        assertSame(builder.getWriter(), writer);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.ResponseBuilder

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.