001: /*
002: * Title: HTMLPage
003: * Description:
004: *
005: * This software is published under the terms of the OpenSymphony Software
006: * License version 1.1, of which a copy has been included with this
007: * distribution in the LICENSE.txt file.
008: */
009:
010: package com.opensymphony.module.sitemesh;
011:
012: import java.io.IOException;
013: import java.io.Writer;
014:
015: /**
016: * Extension of {@link com.opensymphony.module.sitemesh.Page} providing access to HTML data.
017: *
018: * <p>The page is parsed and the <code><title></code>, <code><head></code>
019: * (minus the <code><title></code>) and <code><body></code> are split
020: * into chunks. These can then be used by a {@link com.opensymphony.module.sitemesh.Decorator}.
021: * Properties are also extracted from the HTML.</p>
022: *
023: * <h2>Page Properties</h2>
024: *
025: * <p>When the page is parsed, values from certain tags are added to the properties
026: * to allow easy access to them. The following tags have properties extracted from them.</p>
027: *
028: * <ul>
029: * <li>
030: * <b>HTML Tag</b><br>
031: * All attributes of the <code><html></code>
032: * tag shall be added as properties.
033: * </li>
034: * <li>
035: * <b>TITLE Tag</b><br>
036: * The contents of the <code><title></code> tag
037: * shall be added as the <code>title</code> property.
038: * </li>
039: * <li>
040: * <b>META Tags</b><br>
041: * All the <code><meta></code> tags with
042: * <code>name</code> and <code>content</code> attributes
043: * will be added with the <code>meta</code> prefix.
044: * </li>
045: * <li>
046: * <b>BODY Tag</b><br>
047: * All attributes of the <code><body></code> tag
048: * shall be added as properties with the
049: * <code>body</code> prefix.
050: * </li>
051: * </ul>
052: * <h4>Example</h4>
053: * <pre>
054: * <xmp>
055: * <html template="funky">
056: * <head>
057: * <title>My Funky Page</title>
058: * <meta name="description" content="Description of my page.">
059: * <meta name="author" content="Bob">
060: * ...
061: * </head>
062: * <body text="#ff00ff" bgcolor="green">
063: * ...
064: * </body>
065: * </html>
066: * </xmp>
067: * template=funky
068: * title=My Funky Page
069: * meta.description=Description of my page.
070: * meta.author=Bob
071: * body.text=#ff00ff
072: * body.bgcolor=green
073: * </pre>
074: *
075: * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
076: * @version $Revision: 1.3 $
077: */
078: public interface HTMLPage extends Page {
079:
080: /**
081: * Write the contents of the <code><head></code> tag.
082: */
083: void writeHead(Writer out) throws IOException;
084:
085: /**
086: * Convenience method to return the contents of the <code><head></code> tag as a String.
087: *
088: * @since 2.1.1
089: * @see #writeHead(java.io.Writer)
090: */
091: String getHead();
092:
093: /**
094: * Check to see if this page contains an
095: * <a href="http://www.w3.org/TR/html4/present/frames.html">HTML frameset</a>.
096: */
097: boolean isFrameSet();
098:
099: /**
100: * Marks this page as a frameset.
101: *
102: * @since 2.3
103: * @see #isFrameSet()
104: */
105: void setFrameSet(boolean frameset);
106:
107: }
|