Package com.opensymphony.module.sitemesh

Examples of com.opensymphony.module.sitemesh.DefaultSitemeshBuffer$Builder


    {
        Writer writer = new NullWriter();
        long start = System.currentTimeMillis();
        for (int i = 0; i < times; i++)
        {
            Page page = parser.parse(new DefaultSitemeshBuffer(data));
            page.writeBody(writer);
        }
        long finish = System.currentTimeMillis();
        long time = finish - start;
        System.out.println(name + " total: " + time + "ms");
View Full Code Here


                "    <div>Bye</div>\n" +
                "  </body>\n" +
                "</html>";

        PageParser parser = new DivExtractingPageParser();
        Page page = parser.parse(new DefaultSitemeshBuffer(input.toCharArray()));

        String expectedBody = "" +
                "    <sitemesh:multipass id=\"div.one\"/>\n" +
                "    Blah\n" +
                "    <sitemesh:multipass id=\"div.two\"/>\n" +
View Full Code Here

    private void assertCorrectLength(SitemeshBuffer buffer) throws Exception {
        assertEquals(getContent(buffer).length(), buffer.getTotalLength());
    }

    private SitemeshBuffer newSitemeshBuffer(String content) {
        return new DefaultSitemeshBuffer(content.toCharArray(), content.length());
    }
View Full Code Here

    }

    private SitemeshBuffer newSitemeshBuffer(String content, int pos1, SitemeshBufferFragment frag1) {
        TreeMap<Integer, SitemeshBufferFragment> fragments = new TreeMap<Integer, SitemeshBufferFragment>();
        fragments.put(pos1, frag1);
        return new DefaultSitemeshBuffer(content.toCharArray(), content.length(), fragments);
    }
View Full Code Here

    private SitemeshBuffer newSitemeshBuffer(String content, int pos1, SitemeshBufferFragment frag1, int pos2, SitemeshBufferFragment frag2) {
        TreeMap<Integer, SitemeshBufferFragment> fragments = new TreeMap<Integer, SitemeshBufferFragment>();
        fragments.put(pos1, frag1);
        fragments.put(pos2, frag2);
        return new DefaultSitemeshBuffer(content.toCharArray(), content.length(), fragments);
    }
View Full Code Here

public class RegexReplacementTextFilterTest extends TestCase {

    private SitemeshBufferFragment.Builder body;

    private HTMLProcessor createProcessor(String input) {
        SitemeshBuffer buffer = new DefaultSitemeshBuffer(input.toCharArray());
        body = SitemeshBufferFragment.builder().setBuffer(buffer);
        return new HTMLProcessor(buffer, body);
    }
View Full Code Here

        super.setUp();
        // read blocks from input file.
        this.blocks = readBlocks(new FileReader(file));
        // create PageParser and parse input block into HTMLPage object.
        String input = (String) blocks.get("INPUT");
        this.page = parser.parse(new DefaultSitemeshBuffer(input.toCharArray()));
    }
View Full Code Here

    public void testContentSanity() throws Exception {
        String input = (String) blocks.get("INPUT");
        final char[] chars = input.toCharArray();
        final char[] bigChars = new char[chars.length * 2 + 10]; // make it bigger
        System.arraycopy(chars, 0, bigChars, 0, chars.length);
        Page bigPage = parser.parse(new DefaultSitemeshBuffer(bigChars, chars.length));

        assertEquals(bigPage.getPage(), page.getPage());
    }
View Full Code Here

          }
        }
    }

    public String getContents() {
        SitemeshBufferFragment.Builder buffer = SitemeshBufferFragment.builder().setBuffer(new DefaultSitemeshBuffer(new char[]{}));
        writeTo(buffer, 0);
        return buffer.build().getStringContent();
    }
View Full Code Here

   private static final int SLASH_BODY_HASH = 46434897; // "/body".hashCode();
   private static final int CONTENT_HASH = 951530617; // "content".hashCode();

   public Page parse(char[] buffer) throws IOException
   {
      return parse(new DefaultSitemeshBuffer(buffer));
   }
View Full Code Here

TOP

Related Classes of com.opensymphony.module.sitemesh.DefaultSitemeshBuffer$Builder

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.