01: package com.opensymphony.module.sitemesh.parser;
02:
03: import com.opensymphony.module.sitemesh.html.util.CharArray;
04: import com.opensymphony.module.sitemesh.html.rules.PageBuilder;
05:
06: import java.io.IOException;
07: import java.io.Writer;
08:
09: /**
10: * HTMLPage implementation that builds itself based on the incoming 'tag' and 'text' tokens fed to it from the
11: * HTMLTagTokenizer.
12: *
13: * @see com.opensymphony.module.sitemesh.parser.HTMLPageParser
14: * @see com.opensymphony.module.sitemesh.html.tokenizer.TagTokenizer
15: *
16: * @author Joe Walnes
17: */
18: public class TokenizedHTMLPage extends AbstractHTMLPage implements
19: PageBuilder {
20:
21: private CharArray body;
22: private CharArray head;
23:
24: public TokenizedHTMLPage(char[] original, CharArray body,
25: CharArray head) {
26: this .pageData = original;
27: this .body = body;
28: this .head = head;
29: addProperty("title", "");
30: }
31:
32: public void writeHead(Writer out) throws IOException {
33: out.write(head.toString());
34: }
35:
36: public void writeBody(Writer out) throws IOException {
37: out.write(body.toString());
38: }
39:
40: public String getHead() {
41: return head.toString();
42: }
43:
44: public String getBody() {
45: return body.toString();
46: }
47:
48: public String getPage() {
49: return new String(pageData);
50: }
51:
52: }
|