01: package com.opensymphony.sitemesh.compatability;
02:
03: import com.opensymphony.module.sitemesh.HTMLPage;
04: import com.opensymphony.sitemesh.Content;
05:
06: import java.io.IOException;
07: import java.io.Writer;
08:
09: /**
10: * Adapts a SiteMesh 2 {@link HTMLPage} to a SiteMesh 3 {@link Content}.
11: *
12: * @author Joe Walnes
13: * @since SiteMesh 3
14: */
15: public class HTMLPage2Content implements Content {
16: private final HTMLPage page;
17:
18: public HTMLPage2Content(HTMLPage page) {
19: this .page = page;
20: }
21:
22: public void writeOriginal(Writer out) throws IOException {
23: page.writePage(out);
24: }
25:
26: public int originalLength() {
27: return page.getContentLength();
28: }
29:
30: public void writeBody(Writer out) throws IOException {
31: page.writeBody(out);
32: }
33:
34: public void writeHead(Writer out) throws IOException {
35: page.writeHead(out);
36: }
37:
38: public String getTitle() {
39: return page.getTitle();
40: }
41:
42: public String getProperty(String name) {
43: return page.getProperty(name);
44: }
45:
46: public String[] getPropertyKeys() {
47: return page.getPropertyKeys();
48: }
49:
50: public void addProperty(String name, String value) {
51: page.addProperty(name, value);
52: }
53: }
|