Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/sitemesh/HTMLPage.java


1   package com.sitemesh;
2   
3   import java.io.IOException;
4   import java.io.OutputStream;
5   import java.io.Writer;
6   
7   /**
8    * Extention of {@link com.sitemesh.Page} providing access to HTML data.
9    *
10   * <p>The page is parsed and the <code>&lt;title&gt;</code>, <code>&lt;head&gt;</code>
11   * (minus the <code>&lt;title&gt;</code>) and <code>&lt;body&gt;</code> are split
12   * into chunks. These can then be used by a {@link com.sitemesh.Decorator}.
13   * Properties are also extracted from the HTML.</p>
14   *
15   * <h2>Page Properties</h2>
16   * <p>
17   *   When the page is parsed, values from certain tags are added to the properties
18   *   to allow easy access to them. The following tags have properties extracted
19   *   from them.
20   * </p>
21   * <ul>
22   *   <li>
23   *     <b>HTML Tag</b><br>
24   *     All attributes of the <code>&lt;html&gt;</code>
25   *     tag shall be added as properties.
26   *   </li>
27   *   <li>
28   *     <b>Title Tag</b><br>
29   *     The contents of the <code>&lt;title&gt;</code> tag
30   *     shall be added as the <code>title</code> property.
31   *   </li>
32   *   <li>
33   *     <b>META Tags</b><br>
34   *     All the <code>&lt;meta&gt;</code> tags with
35   *     <code>name</code> and <code>content</code> attributes
36   *     will be added with the <code>meta</code> prefix.
37   *   </li>
38   *   <li>
39   *     <b>BODY Tag</b><br>
40   *     All attributes of the <code>&lt;body&gt;</code> tag
41   *     shall be added as properties with the
42   *     <code>body</code> prefix.
43   *   </li>
44   * </ul>
45   * <h4>Example</h4>
46   * <pre>
47   *   <xmp>
48   *     <html template="funky">
49   *       <head>
50   *         <title>My Funky Page</title>
51   *         <meta name="description" content="Description of my page.">
52   *         <meta name="author" content="Bob">
53   *         ...
54   *       </head>
55   *       <body text="#ff00ff" bgcolor="green">
56   *         ...
57   *       </body>
58   *     </html>
59   *   </xmp>
60   * template=funky
61   * title=My Funky Page
62   * meta.description=Description of my page.
63   * meta.author=Bob
64   * body.text=#ff00ff
65   * body.bgcolor=green
66   * </pre>
67   *
68   * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
69   * @version $Revision: 1.7 $
70   */
71  public interface HTMLPage extends Page {
72  
73    /**
74     * Write the contents of the <code>&lt;head&gt;</code> tag.
75     */
76    void writeHead( OutputStream out ) throws IOException;
77  
78    /**
79     * Write the contents of the <code>&lt;head&gt;</code> tag.
80     */
81    void writeHead( Writer out ) throws IOException;
82  
83    /**
84     * Write the contents of the <code>&lt;body&gt;</code> tag.
85     */
86    void writeBody( OutputStream out ) throws IOException;
87  
88    /**
89     * Write the contents of the <code>&lt;body&gt;</code> tag.
90     */
91    void writeBody( Writer out ) throws IOException;
92  
93    /**
94     * Get the Title of the document
95     */
96    String getTitle();
97  
98    /**
99     * Get the name of the template suitable for the <code>HTMLPage</code>.
100    */
101   String getDecoratorName();
102 
103 }