Package org.apache.tapestry5

Examples of org.apache.tapestry5.MarkupWriter


        ContentType contentType = pageContentTypeAnalyzer.findContentType(page);

        // For the moment, the content type is all that's used determine the model for the markup writer.
        // It's something of a can of worms.

        MarkupWriter writer = markupWriterFactory.newMarkupWriter(contentType);

        markupRenderer.renderPageMarkup(page, writer);

        PrintWriter pw = response.getPrintWriter(contentType.toString());

        long startNanos = System.nanoTime();

        writer.toMarkup(pw);

        long endNanos = System.nanoTime();

        if (logger.isDebugEnabled())
        {
View Full Code Here


        ContentType pageContentType = (ContentType) request.getAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME);

        ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);

        MarkupWriter writer = factory.newPartialMarkupWriter(pageContentType);

        JSONObject reply = new JSONObject();

        // ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.
View Full Code Here

public class MarkupWriterImplTest extends InternalBaseTestCase
{
    @Test(expectedExceptions = IllegalStateException.class)
    public void write_with_no_current_element()
    {
        MarkupWriter w = new MarkupWriterImpl();

        w.write("fail!");
    }
View Full Code Here

    }

    @Test
    public void write_whitespace_before_start_of_root_element_is_ignored()
    {
        MarkupWriter w = new MarkupWriterImpl(new XMLMarkupModel());

        w.write("  ");

        w.element("root");
        w.end();

        assertEquals(w.toString(), "<?xml version=\"1.0\"?>\n<root/>");
    }
View Full Code Here

    }

    @Test
    public void write_whitespace_after_end_of_root_element_is_ignored()
    {
        MarkupWriter w = new MarkupWriterImpl(new XMLMarkupModel());

        w.element("root");
        w.end();

        w.write("  ");

        assertEquals(w.toString(), "<?xml version=\"1.0\"?>\n<root/>");
    }
View Full Code Here

    }

    @Test(expectedExceptions = IllegalStateException.class)
    public void comment_with_no_current_element()
    {
        MarkupWriter w = new MarkupWriterImpl();

        w.comment("fail!");
    }
View Full Code Here

    }

    @Test(expectedExceptions = IllegalStateException.class)
    public void attribute_ns_with_no_current_element()
    {
        MarkupWriter w = new MarkupWriterImpl();

        w.attributeNS("foo", "bar", "baz");
    }
View Full Code Here

    }

    @Test(expectedExceptions = IllegalStateException.class)
    public void define_namespace_with_no_current_element()
    {
        MarkupWriter w = new MarkupWriterImpl();

        w.defineNamespace("foo", "bar");
    }
View Full Code Here

    }

    @Test(expectedExceptions = IllegalStateException.class)
    public void end_with_no_current_element()
    {
        MarkupWriter w = new MarkupWriterImpl();

        w.end();
    }
View Full Code Here

    }

    @Test(expectedExceptions = IllegalStateException.class)
    public void attributes_with_no_current_element()
    {
        MarkupWriter w = new MarkupWriterImpl();

        w.attributes("fail", "now");
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.MarkupWriter

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.