Package com.opensymphony.module.sitemesh

Examples of com.opensymphony.module.sitemesh.PageParser


            return new char[0];
        }

        public Page parse() throws IOException {
            PageParser pageParser = parserSelector.getPageParser(contentType);
            return pageParser != null ? pageParser.parse(getContents()) : null;
        }
View Full Code Here


            closeQuietly(reader);
        }

        char[] page = writer.toCharArray();
        // Create the parsers
        PageParser normal = new HTMLPageParser();
        PageParser fast = new FastPageParser();
        PageParser superfast = new PartialPageParser();

        System.out.println("Amount of data: " + page.length);
        System.gc();
        runPerformanceTest("Normal #1", page, normal, PARSE_COUNT);
        System.gc();
View Full Code Here

                "    <div id='two'>World<br><div id=inner>Great</div></div>\n" +
                "    <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

        }

        for (String p : parsers) {
            String name = props.getProperty("parser." + p + ".class");
            Class<? extends PageParser> parserClass = Class.forName(name).asSubclass(PageParser.class);
            PageParser parser = parserClass.newInstance();

            String filesPath = props.getProperty("parser." + p + ".tests", "src/parser-tests");
            List<File> files = new ArrayList<File>(Arrays.asList(listParserTests(new File(filesPath))));
            Collections.sort(files);
View Full Code Here

    protected void mapParser(String contentType, String className) {
        if (className.endsWith(".DefaultPageParser")) {
            return; // Backwards compatability - this can safely be ignored.
        }
        try {
            PageParser pp = (PageParser) ClassLoaderUtil.loadClass(className, getClass()).newInstance();
            // Store the parser even if the content type is NULL. [This
            // is most probably the legacy default page parser which
            // we no longer have a use for]
            pageParsers.put(contentType, pp);
        }
View Full Code Here

    final char[] chars = page.toCharArray();
    //warm up parser

    for(int i=0;i<10;i++)
    {
      PageParser parser = new HTMLPageParser();
      //FastPageParser parser = new FastPageParser();
      parser.parse(chars);
    }

    //now go crazy
    final int threadCount = 5;
    Thread[] threads = new Thread[threadCount];
    final List[] lists = new ArrayList[threadCount];
    final int passes = 50;
    for(int i=0;i<threads.length;i++)
    {
      final int index = i;
      lists[index] = new ArrayList(passes);
      threads[index] = new Thread(new Runnable()
      {
        public void run()
        {
          for(int j=0;j<passes;j++)
          {
            PageParser parser = new HTMLPageParser();
            //PageParser parser = new FastPageParser();
            try
            {
              lists[index].add(parser.parse(chars));
            }
            catch(IOException e)
            {
              e.printStackTrace();
            }
View Full Code Here

TOP

Related Classes of com.opensymphony.module.sitemesh.PageParser

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.