Examples of HTMLPageParser


Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

    if (pageInfo == null) {
      pageInfo = new PageInfo(webSite, path);
    }
   
    if (pageInfo.getLastModified() != file.lastModified()) {
      HTMLPageParser fpp = new HTMLPageParser();
      Reader reader = null;
     
      try {
        reader = new InputStreamReader(new FileInputStream(file),
            Utils.SYSTEM_CHARSET);
        Page page = fpp.parse(Utils.readAllChars(reader));
        reader.close();
        String title = page.getTitle();
       
        if (Utils.isNullOrWhitespace(title)) {
          title = Utils.beautify(Utils.removeExtension(path), true);
View Full Code Here

Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

        request.setRequestURI("orders/list");
        ServletContext context = webRequest.getServletContext();
        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Test title</title><meta name=\"layout\" content=\"test\"></meta></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
        Decorator d = m.getDecorator(request, page);
        assertNotNull(d);
        assertEquals("/layouts/test.gsp", d.getPage());
        assertEquals("test", d.getName());
    }
View Full Code Here

Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

        ServletContext context = webRequest.getServletContext();

        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Foo title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
        Decorator d = m.getDecorator(request, page);
        assertNotNull(d);
        assertEquals("/layouts/application.gsp", d.getPage());
        assertEquals("application", d.getName());
    }
View Full Code Here

Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);
        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Foo title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
        Decorator d = m.getDecorator(request, page);
        assertNotNull(d);
        assertEquals("/layouts/application.gsp", d.getPage());
        assertEquals("application", d.getName());
    }
View Full Code Here

Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

            request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);
            GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
            Config c = new Config(new MockServletConfig(context));
            m.init(c, null, null);
            HTMLPageParser parser = new HTMLPageParser();
            String html = "<html><head><title>Foo title</title></head><body>here is the body</body></html>";

            Page page = parser.parse(html.toCharArray());
            Decorator d = m.getDecorator(request, page);
            assertNotNull(d);
            assertEquals("/layouts/otherApplication.gsp", d.getPage());
            assertEquals("otherApplication", d.getName());
    }
View Full Code Here

Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);
        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Test title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
        Decorator d = m.getDecorator(request, page);
        assertNotNull(d);
        assertEquals("/layouts/test.gsp", d.getPage());
        assertEquals("test", d.getName());
    }
View Full Code Here

Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

        "}").newInstance();

        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Test title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
        Decorator d = m.getDecorator(request, page);
        assertNotNull(d);
        assertEquals("/layouts/test2/testAction.gsp", d.getPage());
        assertEquals("test2/testAction", d.getName());
    }
View Full Code Here

Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

        request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller);
        GrailsLayoutDecoratorMapper m = new GrailsLayoutDecoratorMapper();
        Config c = new Config(new MockServletConfig(context));
        m.init(c, null, null);
        HTMLPageParser parser = new HTMLPageParser();
        String html = "<html><head><title>Test title</title></head><body>here is the body</body></html>";

        Page page = parser.parse(html.toCharArray());
        Decorator d = m.getDecorator(request, page);
        assertNotNull(d);
        assertEquals("/layouts/mylayout.gsp", d.getPage());
        assertEquals("mylayout", d.getName());
    }
View Full Code Here

Examples of com.opensymphony.module.sitemesh.parser.HTMLPageParser

    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
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.