1 /*
2 * Title: HTMLPage
3 * Description:
4 *
5 * This software is published under the terms of the OpenSymphony Software
6 * License version 1.1, of which a copy has been included with this
7 * distribution in the LICENSE.txt file.
8 */
9
10 package com.opensymphony.module.sitemesh;
11
12 import java.io.IOException;
13 import java.io.Writer;
14
15 /**
16 * Extension of {@link com.opensymphony.module.sitemesh.Page} providing access to HTML data.
17 *
18 * <p>The page is parsed and the <code><title></code>, <code><head></code>
19 * (minus the <code><title></code>) and <code><body></code> are split
20 * into chunks. These can then be used by a {@link com.opensymphony.module.sitemesh.Decorator}.
21 * Properties are also extracted from the HTML.</p>
22 *
23 * <h2>Page Properties</h2>
24 *
25 * <p>When the page is parsed, values from certain tags are added to the properties
26 * to allow easy access to them. The following tags have properties extracted from them.</p>
27 *
28 * <ul>
29 * <li>
30 * <b>HTML Tag</b><br>
31 * All attributes of the <code><html></code>
32 * tag shall be added as properties.
33 * </li>
34 * <li>
35 * <b>TITLE Tag</b><br>
36 * The contents of the <code><title></code> tag
37 * shall be added as the <code>title</code> property.
38 * </li>
39 * <li>
40 * <b>META Tags</b><br>
41 * All the <code><meta></code> tags with
42 * <code>name</code> and <code>content</code> attributes
43 * will be added with the <code>meta</code> prefix.
44 * </li>
45 * <li>
46 * <b>BODY Tag</b><br>
47 * All attributes of the <code><body></code> tag
48 * shall be added as properties with the
49 * <code>body</code> prefix.
50 * </li>
51 * </ul>
52 * <h4>Example</h4>
53 * <pre>
54 * <xmp>
55 * <html template="funky">
56 * <head>
57 * <title>My Funky Page</title>
58 * <meta name="description" content="Description of my page.">
59 * <meta name="author" content="Bob">
60 * ...
61 * </head>
62 * <body text="#ff00ff" bgcolor="green">
63 * ...
64 * </body>
65 * </html>
66 * </xmp>
67 * template=funky
68 * title=My Funky Page
69 * meta.description=Description of my page.
70 * meta.author=Bob
71 * body.text=#ff00ff
72 * body.bgcolor=green
73 * </pre>
74 *
75 * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
76 * @version $Revision: 1.3 $
77 */
78 public interface HTMLPage extends Page {
79
80 /**
81 * Write the contents of the <code><head></code> tag.
82 */
83 void writeHead(Writer out) throws IOException;
84
85 /**
86 * Convenience method to return the contents of the <code><head></code> tag as a String.
87 *
88 * @since 2.1.1
89 * @see #writeHead(java.io.Writer)
90 */
91 String getHead();
92
93 /**
94 * Check to see if this page contains an
95 * <a href="http://www.w3.org/TR/html4/present/frames.html">HTML frameset</a>.
96 */
97 boolean isFrameSet();
98
99 /**
100 * Marks this page as a frameset.
101 *
102 * @since 2.3
103 * @see #isFrameSet()
104 */
105 void setFrameSet(boolean frameset);
106
107 }