Package com.opensymphony.module.sitemesh

Examples of com.opensymphony.module.sitemesh.Page


                request.getSession(true);
            }

            // parse data into Page object (or continue as normal if Page not
            // parseable)
            Page page = parsePage(request, response);

            if (page != null) {
                page.setRequest(request);

                Decorator decorator = factory.getDecoratorMapper().getDecorator(request, page);
                if (decorator != null && decorator.getPage() != null) {
                    applyDecorator(page, decorator, request, response);
                    page = null;
View Full Code Here


        try {
            PageResponseWrapper pageResponse = new PageResponseWrapper(response, factory);
            doRequest(request, pageResponse);
            // check if another servlet or filter put a page object to the
            // request
            Page result = (Page) request.getAttribute(PAGE);
            if (result == null) {
                // parse the page
                result = pageResponse.getPage();
            }
            request.setAttribute(USING_STREAM, new Boolean(pageResponse.isUsingStream()));
View Full Code Here

      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);
        }
       
        pageInfo.setTitle(title);
        pageInfo.setLastModified(file.lastModified());
       
        String keywords = page.getProperty("meta.keywords");
       
        if (!Utils.isNullOrEmpty(keywords)) {
          Matcher matcher = KEYWORDS_REGEX.matcher(keywords);
          List list = new ArrayList();
         
          while (matcher.find()) {
            list.add(matcher.group());
          }
         
          if (list.size() > 0) {
            pageInfo.setKeywords((String[]) list.toArray(new String[list.size()]));
          }
        }

        if (excerptLength > 0) {
          pageInfo.setExcerpt(Utils.limitedLength(Utils.stripHTMLTags
              (page.getBody()), excerptLength));
        } else {
          pageInfo.setExcerpt("");
        }
       
        /*
 
View Full Code Here

  /**
   * Copied from com.opensymphony.module.sitemesh.taglib.AbstactTag for
   * compatibility with SiteMesh
   */
  protected Page getPage() {
    Page p = (Page) pageContext.getAttribute(PAGE, PageContext.PAGE_SCOPE);
   
    if (p == null) {
      p = (Page) pageContext.getAttribute(PAGE, PageContext.REQUEST_SCOPE);
     
      if (p == null) {
View Full Code Here

    return defaultTitle;
  }

  public String getTitle() {
    String title = null;
    Page page = getPage();

    if (page != null) {
      title = page.getTitle();
    }

    if (Utils.isNullOrEmpty(title)) {
      title = defaultTitle;
    }
View Full Code Here

        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

        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

        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

            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

        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

TOP

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

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.